Android Open Source - myglob User Agent Helper






From Project

Back to project page myglob.

License

The source code is released under:

GNU General Public License

If you think the Android project myglob listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * MyGlob Android Application/*from   w w  w . j  a v  a 2s.  c om*/
 * 
 * Copyright (C) 2010 Petar Petrov
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package net.vexelon.myglob.utils;

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

/**
 * 
 * @author petarov
 *
 */
public class UserAgentHelper {
  
  private static String userAgents[] = {
    // IE
    "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
    "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)",
    "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)",
    "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/4.0; InfoPath.2; SV1; .NET CLR 2.0.50727; WOW64)",
    "Mozilla/4.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/5.0)",
    "Mozilla/5.0 (Windows; U; MSIE 9.0; WIndows NT 9.0; en-US))",
    "Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US)",
    "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 7.1; Trident/5.0)",
    "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET CLR 1.0.3705; .NET CLR 1.1.4322)",
    "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; InfoPath.1; SV1; .NET CLR 3.8.36217; WOW64; en-US)",
    // Firefox
    "Mozilla/5.0 (Windows; U; Windows NT 5.1; ro; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8",
    "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120427 Firefox/15.0a1",
    "Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120403211507 Firefox/12.0",
    "Mozilla/5.0 (Windows NT 6.1; de;rv:12.0) Gecko/20120403211507 Firefox/12.0",
    "Mozilla/5.0 (compatible; Windows; U; Windows NT 6.2; WOW64; en-US; rv:12.0) Gecko/20120403211507 Firefox/12.0",
    "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20120421 Gecko Firefox/11.0",
    "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20120421 Firefox/11.0",
    "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko Firefox/11.0",
    "Mozilla/5.0 (Windows NT 6.1; U;WOW64; de;rv:11.0) Gecko Firefox/11.0"    
  };
  
  private static SecureRandom secureRnd;
  
  public static String getRandomUserAgent() {
    try {
      secureRnd = SecureRandom.getInstance("SHA1PRNG");
    }
    catch (NoSuchAlgorithmException e) {
      secureRnd = new SecureRandom();
    }
    
    return userAgents[secureRnd.nextInt(userAgents.length)];
  }

}




Java Source Code List

net.vexelon.mobileops.GLBClient.java
net.vexelon.mobileops.GLBInvoiceXMLParser.java
net.vexelon.mobileops.GLBRequestType.java
net.vexelon.mobileops.HttpClientException.java
net.vexelon.mobileops.IClient.java
net.vexelon.mobileops.InvalidCredentialsException.java
net.vexelon.mobileops.InvoiceException.java
net.vexelon.mobileops.MTLClient.java
net.vexelon.mobileops.SecureCodeRequiredException.java
net.vexelon.myglob.AccountsArrayAdapter.java
net.vexelon.myglob.MainActivity.java
net.vexelon.myglob.OperationsArrayAdapter.java
net.vexelon.myglob.Operations.java
net.vexelon.myglob.UpdateWidgetService.java
net.vexelon.myglob.WidgetProvider4x2.java
net.vexelon.myglob.WidgetProvider.java
net.vexelon.myglob.actions.AccountStatusAction.java
net.vexelon.myglob.actions.ActionExecuteException.java
net.vexelon.myglob.actions.ActionResult.java
net.vexelon.myglob.actions.Action.java
net.vexelon.myglob.actions.BaseAction.java
net.vexelon.myglob.actions.InvoiceLoadCachedAction.java
net.vexelon.myglob.actions.InvoiceUpdateAction.java
net.vexelon.myglob.configuration.AccountPreferencesActivity.java
net.vexelon.myglob.configuration.Defs.java
net.vexelon.myglob.configuration.GlobalSettings.java
net.vexelon.myglob.configuration.LegacySettings.java
net.vexelon.myglob.crypto.CryptoAES.java
net.vexelon.myglob.crypto.Crypto.java
net.vexelon.myglob.crypto.PasswordEngineImpl1.java
net.vexelon.myglob.crypto.PasswordEngineImpl2.java
net.vexelon.myglob.crypto.PasswordEngine.java
net.vexelon.myglob.fragments.AboutFragment.java
net.vexelon.myglob.fragments.BaseFragment.java
net.vexelon.myglob.fragments.HomeFragment.java
net.vexelon.myglob.fragments.IFragmentEvents.java
net.vexelon.myglob.fragments.InvoiceFragment.java
net.vexelon.myglob.users.AccountType.java
net.vexelon.myglob.users.User.java
net.vexelon.myglob.users.UsersManager.java
net.vexelon.myglob.utils.Base64.java
net.vexelon.myglob.utils.DateUtils.java
net.vexelon.myglob.utils.TrustAllSocketFactory.java
net.vexelon.myglob.utils.UserAgentHelper.java
net.vexelon.myglob.utils.Utils.java