Last active
August 29, 2015 14:27
-
-
Save ri-sh/818da44bd3742947929e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------------- | |
# Name: ashiyan | |
# Purpose: | |
# | |
# Author: rishabh | |
# | |
# Created: 17/08/2015 | |
# Copyright: (c) hp 2015 | |
# Licence: <your licence> | |
#------------------------------------------------------------------------------- | |
from bs4 import BeautifulSoup | |
from hashlib import md5 | |
import os | |
cj =cookielib.CookieJar() | |
opener=urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) | |
opener.addheaders=[('User-Agent',"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36")] | |
opener.addheaders=[('Referer',"http://ashiyane.org/forums/register.php")] | |
req=opener.open('http://ashiyane.org/forums/register.php').read() | |
regpage= BeautifulSoup (req) | |
h_verify = req | |
os.system('''rm -rf F:/humanverify.txt''') | |
f1=open("F:/humanverify.txt","w") | |
f1.write(h_verify) | |
f1.close() | |
os.system('''cat F:/humanverify.txt | grep -i "description" | cut -d">" -f2 | cut -d"<" -f1 | sed "5q;d" > F:/out1.txt ''') | |
f2=open("F:/out1.txt","r") | |
line2=f2.readline() | |
f2.close() | |
print "The random question that was created by target site is:\n", line2 | |
print "The len of this string is:",len(line2) | |
h_len=len(line2) | |
if (h_len==38): | |
h_answer=u'فروردین' | |
elif (h_len==43): | |
h_answer='8' | |
elif (h_len==63): | |
h_answer=u'اسیا' | |
elif (h_len==70): | |
h_answer=u'تهران' | |
else: | |
print "Script can\'t detect the type of question." | |
pass | |
print h_answer | |
div= regpage.findAll("div",{"class":"blockrow"}) | |
#print div[3].find('p') | |
print div[3].findAll('input')[1].attrs['value'] | |
humanverify_hash= div[3].findAll('input')[1].attrs['value'] | |
username='xenorov' | |
#human_verify='تهران' | |
paswword= 'workhard123' | |
pass_md5=md5(paswword).hexdigest() | |
email='[email protected]' | |
data={'username':username, | |
'password':'', | |
'passwordconfirm':'', | |
'email':email, | |
'emailconfirm':email, | |
'humanverify[input]':h_answer, | |
'humanverify[hash]':humanverify_hash, | |
'timezoneoffset':'3.5', | |
'dst':'2', | |
'options[adminemail]':'1', | |
'agree':'1', | |
's':'', | |
'securitytoken':'guest', | |
'do':'addmember', | |
'url':'http://ashiyane.org/forums/index.php', | |
'password_md5':pass_md5, | |
'passwordconfirm_md5':pass_md5, | |
'day':'', | |
'month':'', | |
'year':'' | |
} | |
import urllib | |
print urllib.urlencode(data) | |
t= opener.open('http://ashiyane.org/forums/register.php',urllib.urlencode(data)) | |
os.system('''rm -rf F:/ashiyane.html''') | |
f= open('F:/ashiyane.html','w') | |
f.write(t.read()) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment