Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Account creator using 2captcha


    Decipher

    Recommended Posts

    Decided to post this from my old account creation script (notice old)
    Please note only SendReq written by me, the rest is 2captcha api
     

    Usage:

    SendReq req = new SendReq("decipher", 18, "[email protected]", "decipher123");
    req.createAccount(your 2captcha key);
    

    SendReq.java
     

     

    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.DataOutputStream;
    import java.io.File;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.URL;
    
    import javax.net.ssl.HttpsURLConnection;
    
    import org.dreambot.api.methods.MethodProvider;
    
    import account.captcha.TwoCaptchaService;
    import account.generator.RandomUserAgent;
    
    /*
    Created by deki
    */
    
    public class SendReq {
    
    	private String username;
    	private int age;
    	private String email;
    	private String password;
    	
    	public SendReq(String username, int age, String email, String password){
    		this.username = username;
    		this.age = age;
    		this.email = email;
    		this.password = password;
    	}
    	
    	private String getRecaptcha(String apiKey){
    		String googleKey = "6LccFA0TAAAAAHEwUJx_c1TfTBWMTAOIphwTtd1b";
    		String pageUrl = "https://secure.runescape.com/m=account-creation/g=oldscape/create_account?trialactive=true";
    		
    		TwoCaptchaService service = new TwoCaptchaService(apiKey, googleKey, pageUrl);
    		
    		try {
    			String responseToken = service.solveCaptcha();
    			System.out.println("The response token is: " + responseToken);
    			if (!responseToken.contains("ERROR")){
    			return responseToken;
    			}
    		} catch (InterruptedException e) {
    			System.out.println("Error grabbing key:");
    			e.printStackTrace();
    		} catch (IOException e) {
    			System.out.println("Error grabbing key:");
    			e.printStackTrace();
    		}
    		return null;
    	}
    	
    	public boolean createAccount(String apiKey) throws IOException {
    		String username = this.username;
    		int age = this.age;
    		String email = this.email;
    		String password = this.password;
    		String recaptchaResponse = getRecaptcha(apiKey);
    		String params =
    				"trialactive=true"
    				+"&trialactive=true"
    				+"&onlyOneEmail=1"
    				+"&displayname_present=true"
    				+"&age="+age
    				+"&displayname="+username
    				+"&email1="+email
    				+"&password1="+password
    				+"&password2="+password
    				+"&agree_email=on"
    				+"&g-recaptcha-response="+recaptchaResponse
    				+"&submit=Join+Now";
    		URL obj = new URL("https://secure.runescape.com/m=account-creation/g=oldscape/create_account");
    		HttpsURLConnection con = (HttpsURLConnection)obj.openConnection();
    		String USER_AGENT = RandomUserAgent.getRandomUserAgent();
    		System.out.println("User agent: " + USER_AGENT);
    		//add request header
    		con.setRequestMethod("POST");
    		con.setRequestProperty("Host", "secure.runescape.com");
    		con.setRequestProperty("User-Agent",USER_AGENT);
    		con.setRequestProperty("Accept","text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
    		con.setRequestProperty("Accept-Language", "en-US,en);q=0.5");
    		con.setRequestProperty("Accept-Encoding", "gzip, deflate, br");
    		con.setRequestProperty("Referer","http://oldschool.runescape.com/");
    		//Send post request
    		if ( recaptchaResponse != null && !recaptchaResponse.contains("ERROR")){
    		MethodProvider.sleep(8000, 10000);
    		con.setDoOutput(true);
    		DataOutputStream wr = new DataOutputStream(con.getOutputStream());
    		wr.writeBytes(params);
    		wr.flush();
    		wr.close();
    		
    		BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    		String inputLine;
    		StringBuffer response = new StringBuffer();
    		
    		while((inputLine = in.readLine()) != null){
    			response.append(inputLine);
    		}
    		in.close();
    		File file = new File("accs.txt");
    		if (!file.exists()){
    			file.createNewFile();
    		}
    		try(FileWriter fw = new FileWriter("accs.txt", true);
    			    BufferedWriter bw = new BufferedWriter(fw);
    			    PrintWriter out = new PrintWriter(bw))
    			{
    			    out.println(email + ":" + password);
    			} catch (IOException e) {
    			}
    		}else
    			System.out.println("Captcha was error or null, not sending post to osrs servers");
    			return true;
    	}
    	
    	public String getUsername(){
    		return username;
    	}
    	
    	public int getAge(){
    		return age;
    	}
    	
    	public String getEmail(){
    		return email;
    	}
    	
    	public String getPassword(){
    		return password;
    	}
    }
    
    

     


     
    TwoCaptchaService.java
     

     

    	import java.io.IOException;
    
    
    	public class TwoCaptchaService {
    		
    		private String apiKey;
    		private String googleKey;
    		private String pageUrl;
    		
    		private String proxyIp;
    		private String proxyPort;
    		private String proxyUser;
    		private String proxyPw;
    		private ProxyType proxyType;
    		
    		private HttpWrapper hw;
    		
    		
    		public TwoCaptchaService(String apiKey, String googleKey, String pageUrl) {
    			this.apiKey = apiKey;
    			this.googleKey = googleKey;
    			this.pageUrl = pageUrl;
    			hw = new HttpWrapper();
    		}
    		
    		public TwoCaptchaService(String apiKey, String googleKey, String pageUrl, String proxyIp, String proxyPort, ProxyType proxyType) {
    			this(apiKey, googleKey, pageUrl);
    			this.proxyIp = proxyIp;
    			this.proxyPort = proxyPort;
    			this.proxyType = proxyType;
    		}
    		
    		public TwoCaptchaService(String apiKey, String googleKey, String pageUrl, String proxyIp, String proxyPort,
    				String proxyUser, String proxyPw, ProxyType proxyType) {
    			this(apiKey,googleKey,pageUrl);
    			this.proxyIp = proxyIp;
    			this.proxyPort = proxyPort;
    			this.proxyUser = proxyUser;
    			this.proxyPw = proxyPw;
    			this.proxyType = proxyType;
    		}
    		
    		public String solveCaptcha() throws InterruptedException, IOException {
    			System.out.println("Sending recaptcha challenge to 2captcha.com");
    			
    			String parameters = "key=" + apiKey
    					+ "&method=userrecaptcha"
    					+ "&googlekey=" + googleKey
    					+ "&pageurl=" + pageUrl;
    					
    			if (proxyIp != null) {
    				if (proxyUser != null) {
    					parameters += "&proxy=" 
    							+ proxyUser + ":" + proxyPw 
    							+ "@"
    							+ proxyIp + ":" + proxyPort;
    				} else {
    					parameters += "&proxy=" 
    							+ proxyIp + ":" + proxyPort;
    				}
    				
    				parameters += "&proxytype=" + proxyType;
    			}
    			hw.get("http://2captcha.com/in.php?" + parameters);
    			
    			String captchaId = hw.getHtml().replaceAll("\\D", "");
    			int timeCounter = 0;
    			
    			do {
    				hw.get("http://2captcha.com/res.php?key=" + apiKey 
    						+ "&action=get"
    						+ "&id=" + captchaId);
    				
    				Thread.sleep(1000);
    				
    				timeCounter++;
    				System.out.println("Waiting for captcha to be solved... elapsed " + timeCounter);
    			} while(hw.getHtml().contains("NOT_READY"));
    			System.out.println("It took "  + timeCounter + " seconds to solve the captcha");
    			String gRecaptchaResponse = hw.getHtml().replaceAll("OK\\|", "").replaceAll("\\n", "");
    			return gRecaptchaResponse;
    		}
    
    		public String getApiKey() {
    			return apiKey;
    		}
    		
    		public void setApiKey(String apiKey) {
    			this.apiKey = apiKey;
    		}
    		
    		public String getGoogleKey() {
    			return googleKey;
    		}
    		
    		public void setGoogleKey(String googleKey) {
    			this.googleKey = googleKey;
    		}
    		
    		public String getPageUrl() {
    			return pageUrl;
    		}
    		
    		public void setPageUrl(String pageUrl) {
    			this.pageUrl = pageUrl;
    		}
    		
    		public String getProxyIp() {
    			return proxyIp;
    		}
    		
    		public void setProxyIp(String proxyIp) {
    			this.proxyIp = proxyIp;
    		}
    		
    		public String getProxyPort() {
    			return proxyPort;
    		}
    		
    		public void setProxyPort(String proxyPort) {
    			this.proxyPort = proxyPort;
    		}
    		
    		public String getProxyUser() {
    			return proxyUser;
    		}
    		
    		public void setProxyUser(String proxyUser) {
    			this.proxyUser = proxyUser;
    		}
    		
    		public String getProxyPw() {
    			return proxyPw;
    		}
    		
    		public void setProxyPw(String proxyPw) {
    			this.proxyPw = proxyPw;
    		}	
    		
    		public ProxyType getProxyType() {
    			return proxyType;
    		}
    		
    		public void setProxyType(ProxyType proxyType) {
    			this.proxyType = proxyType;
    		}
    }
    
    

     


     
    HttpWrapper.java
     

     

    import java.io.BufferedReader;
    import java.io.DataInputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.HttpURLConnection;
    import java.net.URL;
    
    
    public class HttpWrapper {
    	
        private boolean printHeaders = false;
        private String html;
        private int responseCode = 0;
        
        public HttpWrapper() {
            html = "";
        }
        
        public void get(String url) {
            
        	try {
                URL url_ = new URL(url);
                HttpURLConnection conn;
                            
                conn = (HttpURLConnection) url_.openConnection();
                conn.setRequestMethod("GET");
                conn.setAllowUserInteraction(false);
                conn.setDoOutput(false);
                conn.setInstanceFollowRedirects(false);
                
                conn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0");
                conn.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
                conn.setRequestProperty("Accept-Language", "en-US,en;q=0.8");
                conn.setRequestProperty("Connection", "keep-alive");
                 
                String headers = "";
                
                if (printHeaders) {
    	            for(String key: conn.getHeaderFields().keySet())
    	                headers += ((key != null)?key + ": ":"") + conn.getHeaderField(key) + "\n";
                }
                
                responseCode = conn.getResponseCode();
                
                BufferedReader d = new BufferedReader(new InputStreamReader(new DataInputStream(conn.getInputStream())));
                String result = "";
                String line = null;
                while ((line = d.readLine()) != null) {
                	line = new String(line.getBytes(),"UTF-8");
                	result += line + "\n";
                }
    
                d.close();
                
                if (printHeaders) {
                    setHtml(headers + "\n" + result);
                } else {
                    setHtml(result);
                }
            } catch (IOException e) {
                throw new IllegalStateException("An IOException occurred:" + "\n" + e.getMessage());
            }
        }
     
        public String getHtml() {
            return this.html;
        }
        
        private void setHtml(String html) {
            this.html = html;
        }
        
        public void setPrintHeaders(boolean trueOrFalse) {
        	printHeaders = trueOrFalse;
        }
        
        public int getResponseCode() {
        	return responseCode;
        }
    }
    
    

     


     
    ProxyType.java

     

     

     

    public enum ProxyType {
    	HTTP, HTTPS, SOCKS4, SOCKS5;
    }
    

     

     

    Link to comment
    Share on other sites

    • 5 weeks later...

    Awesome this is exactly what I'm looking for! I do have a few questions though:
    ​1. What package is required on 2captcha? Is it recaptcha v2? (I get a lot of the picture solving ones it seems)

    ​2. Does this script work? I notice you wrote old (and emphasized the word old) So prior to buying and testing it out, will it work ? lol Thanks!

    Link to comment
    Share on other sites

    • 5 weeks later...

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.