-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.py
More file actions
70 lines (60 loc) · 2.14 KB
/
script.py
File metadata and controls
70 lines (60 loc) · 2.14 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
70
import os
def main():
login = 'admin'
passw = 'admin'
ip_count = 50
path_to_inp_file = 'c:\\test\\IPs.txt'
path_to_out_file = 'c:\\test\\ip_out_'
print('Использовать стандартные настройки?\nДа[y]/Нет[n]')
if input() != 'y':
select = menu()
while select != 0:
if select == 1:
os.system('cls')
print('Логин = ', end='')
login = input()
elif select == 2:
os.system('cls')
print('Пароль = ', end='')
passw = input()
elif select == 3:
os.system('cls')
print('Путь до входного файла = ', end='')
path_to_inp_file = input()
elif select == 4:
os.system('cls')
print('Путь до выходного файла = ', end='')
path_to_out_file = input()
elif select == 5:
os.system('cls')
print('Количество IP в файле = ', end='')
ip_count = int(input())
select = menu()
file = open(path_to_inp_file, 'r')
k = 0
j = 1
for line in file:
csv = open(path_to_out_file + str(j) + '.csv', 'a')
temp = '"' + str(k) + '_ip","0","' + line[
0:-1:1] + '","8000","0","' + login + '","' + passw + '","0","1","0","0"' + '\n'
csv.write(temp)
k += 1
if k % ip_count == 0:
j += 1
csv.close()
file.close()
print('Готово')
print('Press any key to continue...')
input()
def menu():
os.system('cls')
print('Что меняем?', end='\n')
print('[1] Логин', end='\n')
print('[2] Пароль', end='\n')
print('[3] Путь до входного файла', end='\n')
print('[4] Путь до выходного файла', end='\n')
print('[5] Количество IP в файле')
print('[0] Выполнить', end='\n')
return int(input())
if __name__ == '__main__':
main()