Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket, re, time
- def login_tw():
- user = "";
- passw = "";
- data = "user="+user+"&clear=true&password="+passw+"&server=en50"
- query = "POST /index.php?action=login&server_en50 HTTP/1.1\r\n"
- query = query + "Host: tribalwars.net\r\n"
- query = query + "User-Agent: Mozilla/5.0\r\n"
- query = query + "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
- query = query + "Accept-Language: en-us;en;q=0.5\r\n"
- query = query + "Accept-Encoding: gzip, deflate\r\n"
- query = query + "Keep-Alive: 115\r\n"
- query = query + "Connection: keep-alive\r\n"
- query = query + "Content-Type: application/x-www-form-urlencoded\r\n"
- query = query + "Content-Length: "+str(len(data))+"\r\n\r\n"
- query = query + data+"\r\n\r\n"
- site = "tribalwars.net"
- host = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- host.connect((site, 80))
- host.send(query)
- data = host.recv(1024)
- return data
- def write_file(data):
- print data
- file = open("session_id.txt","w")
- get_info = re.search("Location: (.*)", data)
- if get_info:
- file.write(get_info.group(1).strip())
- write_file(login_tw())
- sleep_delay = 3600
- while 1:
- write_file(login_tw())
- time.sleep(sleep_delay)
- -----------------------
- <?php
- // phpinfo();
- $file = "C:\Python26\session_id.txt";
- $read_data = fopen($file,"r");
- while(!feof($read_data))
- {
- $content = fread($read_data, 128);
- }
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $content);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_COOKIEJAR, "C:\Python26\cookie_id.txt");
- curl_setopt($ch, CURLOPT_COOKIEFILE, "C:\Python26\cookie_id.txt");
- $result = curl_exec($ch);
- curl_close($ch);
- echo $result;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement