-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlibconfig.py
72 lines (65 loc) · 2.51 KB
/
libconfig.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
67
68
69
70
71
72
import subprocess
import os
conf = "settings.conf"
def skipLines(file, howmuch):
for i in range(howmuch):
file.readline()
def readConfWordlist():
conffile = open(conf)
line = conffile.readline().replace("\n","")
array = line.split("=")
if array[1] != "" or array[1] != " " or array[1] != None:
return array[1]
def readConfQuietMode():
conffile = open(conf)
skipLines(conffile, 1)
line = conffile.readline().split("=")
return line[1]
def readConfFile():
conffile = open(conf)
skipLines(conffile, 2)
line = conffile.readline().replace("\n", "").split("=")
return line[1]
def readConfAutoSet():
conffile = open(conf)
skipLines(conffile, 3)
line = conffile.readline().replace("\n", "").split("=")
return line[1]
def changeParameter(parameter, value):
conffile = open(conf)
line1 = conffile.readline().replace("\n","")
line2 = conffile.readline().replace("\n","")
line3 = conffile.readline().replace("\n","")
line4 = conffile.readline().replace("\n","")
if parameter == "wordlist":
conffile = open(conf)
os.system("rm settings.conf")
os.system("touch settings.conf")
os.system(f"echo \"{parameter}={value}\" >> settings.conf")
os.system(f"echo \"{line2}\" >> settings.conf")
os.system(f"echo \"{line3}\" >> settings.conf")
os.system(f"echo \"{line4}\" >> settings.conf")
elif parameter == "quietmode":
conffile = open(conf)
os.system("rm settings.conf")
os.system("touch settings.conf")
os.system(f"echo \"{line1}\" >> settings.conf")
os.system(f"echo \"{parameter}={value}\" >> settings.conf")
os.system(f"echo \"{line3}\" >> settings.conf")
os.system(f"echo \"{line4}\" >> settings.conf")
elif parameter == "file":
conffile = open(conf)
os.system("rm settings.conf")
os.system("touch settings.conf")
os.system(f"echo \"{line1}\" >> settings.conf")
os.system(f"echo \"{line2}\" >> settings.conf")
os.system(f"echo \"{parameter}={value}\" >> settings.conf")
os.system(f"echo \"{line4}\" >> settings.conf")
elif parameter == "autoset":
conffile = open(conf)
os.system("rm settings.conf")
os.system("touch settings.conf")
os.system(f"echo \"{line1}\" >> settings.conf")
os.system(f"echo \"{line2}\" >> settings.conf")
os.system(f"echo \"{line3}\" >> settings.conf")
os.system(f"echo \"{parameter}={value}\" >> settings.conf")