forked from mhaberler/directoryd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbotinfoupdate.py
41 lines (37 loc) · 966 Bytes
/
botinfoupdate.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
#!/bin/bash
import sys
def updatebotinfo(botinfofile,botnum,botip,indents):
lineno = 0
f = open(botinfofile,"r")
s = ""
first = True
second = False
third = False
skip = False
ipline = indents*" "+ 'ip = "'+botip + '";\n';
for line in f.readlines():
if skip:
s+= ipline
skip = False
continue
if "NEXUS7" in line and first:
s += line
first = False
second = True
skip = False
elif "NEXUS7" in line and second and botnum == 1:
s += line
second = False
third = True
skip = True
elif "NEXUS7" in line and third and botnum == 2:
s += line
third = False
skip = True
else:
s+= line
f.close()
f = open(botinfofile,"w")
f.write(s)
f.close()
updatebotinfo("BotInfoSelector.java",int(sys.argv[1]),sys.argv[2],16)