-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
66 lines (42 loc) · 1.99 KB
/
setup.py
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
import os, math, sys
OS_bit = (round(math.log(sys.maxint,2)+1)) # get the bit
os.system("sudo apt-get install python-pip && sudo apt-get install tor") # installing dependencies
os.system("pip install -U selenium")
os.system("pip install mechanize && pip install requests")
os.system("pip install stem && pip install pyvirtualdisplay && apt-get install xvfb")
print("\n \n {} \n \n".format(OS_bit))
os.system('firefox -v > tmp') # store result of firefox -v in tmp
result = open('tmp', 'r').read() # result var reads the output
marker = result.find('Firefox') + 8 # marker marks the 8th letter from the word "Firefox"
version = result[marker:].splitlines()[0] # spliting the output, the version is something like aa.bb.cc
a,b,c = version.split(".") # firefoxV is the var with the aa
os.remove('tmp') # removing the temporary file
FirefoxVersion = int(a)
second = 0
if OS_bit == 64:
bit = 64
elif OS_bit == 32:
bit = 32
if FirefoxVersion < 53:
first = 16
second = 1
elif FirefoxVersion == 53 or FirefoxVersion == 54:
first = 18
elif FirefoxVersion > 54:
first = 19
os.system("wget https://github.com/mozilla/geckodriver/releases/download/v0.{}.{}/geckodriver-v0.{}.{}-linux{}.tar.gz".format(first,second,first,second,bit))
os.system("tar -xvzf geckodriver-v0.{}.{}-linux{}.tar.gz".format(first,second,bit))
os.system("rm geckodriver-v0.{}.{}-linux{}.tar.gz".format(first,second,bit))
os.system("chmod +x geckodriver")
os.system("mv geckodriver /usr/local/bin/")
fp = open("/etc/tor/torrc")
fx = open("/etc/tor/torrc2","w+") #torrc with edits
for i, line in enumerate(fp): #some reading and editing action going on here
if i+1 == 57 or i+1 == 61:
line = line.replace("#","")
fx.write(line)
fp.close()
fx.close()
os.system("rm /etc/tor/torrc && mv /etc/tor/torrc2 /etc/tor/torrc")
os.system("service tor restart && service tor stop")
print("\ntorrc modification success\n")