-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnetSend.py
More file actions
162 lines (127 loc) · 3.62 KB
/
netSend.py
File metadata and controls
162 lines (127 loc) · 3.62 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
import os
def Menu():
os.system("clear")
print "---NetSend---"
print "[1] Send message to a single computer"
print "[2] Send message to multiple computers"
print "[3] Send spam to a single computer"
print "[4] Send spam to multiple computers"
print "[5] view computers on network"
try:
option = int(raw_input("Option: "))
if option == 1:
get_mach("single", "one", "single_msg_one_mach")
elif option == 2:
get_mach("single", "multi", "single_msg_multi_mach")
elif option == 3:
get_mach("spam", "one", "spam_msg_one_mach")
elif option == 4:
get_mach("spam", "multi", "spam_msg_multi_mach")
elif option == 5:
view_comps_on_network()
else:
print "error testing..."
pause = raw_input()
exit()
errors("menu_option_err")
except ValueError:
print "error testing..."
pause = raw_input()
exit()
errors("menu_option_err")
def get_mach(msg_type, mach_type, net_send_type):
if mach_type == "one":
computer_name = raw_input("computer name or ip: ")
if len(computer_name) == 0:
#call error
print "error testing..."
pause = raw_input()
exit()
else:
get_msg(msg_type, mach_type, net_send_type, computer_name)
elif mach_type == "multi":
computer_names = []
try:
print "enter the name or ip of the computes with a space between each one"
print "for example: computer1 computer2 computer3\n"
computer_names_str = raw_input("computer names: ")
if len(computer_names_str) < 1:
#calls errors
print "error testing..."
pause = raw_input()
exit()
else:
computer_names = computer_names_str.split()
get_msg(msg_type, mach_type, net_send_type, computer_names)
except ValueError:
#call errors
print "error testing..."
pause = raw_input()
exit()
def get_msg(msg_type, mach_type, net_send_type, computerNames):
message = raw_input("message: ")
if len(message) == 0:
#calls errors
print "error testing..."
pause = raw_input()
exit()
else:
if msg_type == "single":
net_send(net_send_type, computerNames, message, "NA")
else:
try:
spam_count = int(raw_input("number of times to spam: "))
if spam_count == 0:
#calls errors
print "error testing..."
pause = raw_input()
exit()
else:
net_send(net_send_type, computerNames, message, spam_count)
except ValueError:
#calls errors
print "error testing..."
pause = raw_input()
exit()
def net_send(net_send_type, computerNames, message, spamCount):
if net_send_type == "single_msg_one_mach":
#send message to single machine
#os.system("net send %s %s" % (computerNames, message))
#os.system("PAUSE")
#Menu()
print "net send %s %s" % (computerNames, message)
print "message sent to %s" % computerNames
pause = raw_input("Press any key to continue...")
Menu()
elif net_send_type == "single_msg_multi_mach":
numb_of_computers = len(computerNames)
i = 0
while i < numb_of_computers:
#os.system("net send %s %s" % (computerNames[i], message))
print "net send %s %s" % (computerNames[i], message)
print "message sent to %s" % computerNames[i]
i += 1
pause = raw_input("Press any key to continue...")
Menu()
elif net_send_type == "spam_msg_one_mach":
print net_send_type
print computerNames
print message
print spamCount
elif net_send_type == "spam_msg_multi_mach":
print net_send_type
print computerNames
print message
print spamCount
else:
pass
def view_comps_on_network():
#os.system("net view")
#os.system("PAUSE")
print "will use the 'net view' command to list computers on network"
pause = raw_input()
Menu()
def errors(error_type):
print "test1"
print "error testing..."
Menu()