Register Gästebuch Calendar Members List Team Members Frequently Asked Questions Search Go to the Main Page
HackBox Forum
Forum Linkliste Online Spiele Datenbank Forum Foto Galerie Chat Portalansicht des Forum

HackBox Forum » Computer & Co » Software » Subnetting tool » Hello Guest [Login|Register]
Last Post | First Unread Post Print Page | Add Thread to Favorites
Post New Thread Post Reply
Go to the bottom of this page Subnetting tool
Author
Post « Previous Thread | Next Thread »
DrW3sk3r DrW3sk3r is a male
Grünschnabel


images/avatars/avatar-132.jpg
[meine Galerie]


Registration Date: 05.04.2013
Posts: 6
Herkunft: Deutschland

Subnetting tool Reply to this Post Post Reply with Quote Edit/Delete Posts Report Post to a Moderator       Go to the top of this page

Halli hallo,

Nach sehr langer Zeit dachte ich ich melde mich mal wieder :3

Ich habe hier ein Subnetting Script was einen die Netz-ID, Boradcastaddresse, anzahl der Subnetze etc ausrechnet wer interesse hatt kann sich den Code runterladen.

Der Code ist opensource also jeder kann dran rumbasteln

Der Code läuft auf Python 2.7.X
Download http://python.org

code:
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:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
490:
491:
492:
493:
494:
495:
496:
497:
498:
499:
500:
501:
502:
503:
504:
505:
506:
507:
508:
509:
510:
511:
512:
513:
514:
515:
516:
517:
518:
519:
520:
521:
522:
523:
524:
525:
526:
527:
528:
529:
530:
531:
532:
533:
534:
535:
536:
537:
538:
539:
540:
541:
542:
543:
544:
545:
546:
547:
548:
549:
550:
551:
552:
553:
554:
#!/usr/bin/env python
#coding: utf-8
import math
import os
temp = ""
bincodepart = ""
bincode = ""
binip = ""
netid = ""
bcast = ""
running = True

def netclasses(part1):
	part1 = int(part1)
	if(part1 < 128):
		print "Class A network 255.0.0.0"
	elif(part1 < 192):
		print "Class B network 255.255.0.0"  
	elif(part1 < 224):
		print "Class C network 255.255.255.0" 
	elif(part1 < 240):
		print "Class D network"
	else:
		print "Class E network"
		
def binary(x): #Dezmail zu Binär mit dem Resteverfahren
  global bincode
  if(float(x) <= 0 or int(x) == 0):
    return
  else:
    int(x)
    temp = x
    if(int(x) % 2 == 0):
      bincode = bincode + "0"
      temp =  float(temp) / 2
    else:
      bincode = bincode + "1"
      temp =  float(temp) / 2 - 0.5
  binary(temp)

def bin_checker(x): #Binärcodeteile werden zum oktet gemacht
  global binip
  if(len(x) == 0 or x == ""):
    x = x + "00000000"
  elif(len(x) == 1):
    x = x + "0000000"
  elif(len(x) == 2):
    x = x + "000000"
  elif(len(x) == 3):
    x = x + "00000"
  elif(len(x) == 4):
    x = x + "0000"
  elif(len(x) == 5):
    x = x + "000"
  elif(len(x) == 6):
    x = x + "00"
  elif(len(x) == 7):
    x = x + "0"
  bincodepart = x
  #print bincodepart[::-1]
  
  binip = binip + bincodepart[::-1] + "."
  bincodepart = ""
def net_id(ip, subnet):
  global netid
  netid = ""
  ip = ip.replace(".","")
  subnet = subnet.replace(".","")
  #print ip
  #print subnet
  ipnetlen = len(ip)
  #print ipnetlen
  for i in range(0, ipnetlen):
    a= ip[i]
    b= subnet[i]
    if(a == "1" and b == "1"):
      netid = netid + "1"
    else:
      netid = netid + "0"
  temp_netid = netid
  n_part1 = int(netid[0:8], 2)
  n_part2 = int(netid[8:16], 2)
  n_part3 = int(netid[16:24], 2)
  n_part4 = int(netid[24:32], 2)
  netid = str(n_part1) + "." + str(n_part2) + "." + str(n_part3) + "." + str(n_part4) 
  print ("Netz-ID: " + netid)
  broadcast(temp_netid, subnet)
  
def broadcast(net, subnet):
  global bcast
  bcast = ""
  subnet = subnet.replace("1", "H").replace("0", "L")
  subnet = subnet.replace("H", "0").replace("L", "1")
  #print subnet
  ipnetlen = len(subnet)             
  #print ipnetlen 
  for i in range(0, ipnetlen):
    a = net[i]
    b = subnet[i]
    if(a == "1" or b== "1" or a == "1" and b == "1"):
      bcast = bcast + "1"
    else:
      bcast = bcast + "0"
  bc_part1 = int(bcast[0:8], 2)
  bc_part2 = int(bcast[8:16], 2)
  bc_part3 = int(bcast[16:24], 2)
  bc_part4 = int(bcast[24:32], 2)
  bcast = str(bc_part1) + "." + str(bc_part2) + "." + str(bc_part3) + "." + str(bc_part4) 
  print ("Broadcast Addresse: " + bcast)
  
def netid_broadcast():
  global bincode
  global binip
  ip = raw_input("Geben sie die Hostadresse ein: ")
  ip = ip.split(".")

  #print ip[0]
  netclasses(ip[0])
  binary(ip[0])
  bin1 = bincode
  bin_checker(bin1)
  bincode = ""

  #print ip[1]
  binary(ip[1])
  bin2 = bincode
  bin_checker(bin2)
  bincode = ""

  #print ip[2]
  binary(ip[2])
  bin3 = bincode
  bin_checker(bin3)
  bincode = ""

  #print ip[3]
  binary(ip[3])
  bin4 = bincode
  bin_checker(bin4)
  bincode = ""

  binip = binip[:-1]
  #print binip
  print "--------------------------------------------"
  temp_binip = binip

  binip = ""
  nmask = raw_input("Geben sie die Subnetzwerkmaske ein: ")
  nmask = nmask.split(".")

  #print ip[0]
  binary(nmask[0])
  bin1 = bincode
  bin_checker(bin1)
  bincode = ""

  #print ip[1]
  binary(nmask[1])
  bin2 = bincode
  bin_checker(bin2)
  bincode = ""

  #print ip[2]
  binary(nmask[2])
  bin3 = bincode
  bin_checker(bin3)
  bincode = ""

  #print ip[3]
  binary(nmask[3])
  bin4 = bincode
  bin_checker(bin4)
  bincode = ""

  binip = binip[:-1]
  #print binip

  net_id(temp_binip, binip)
  temp_binip = ""
  binip = ""
  raw_input("Drücke Enter um das Programm weiter auszuführen :")
  
  
def get_subnets(x , y):
  #print str(x)
  x = x.replace(".", "")
  smask_part1 = x[0:8]
  #print smask_part1
  smask_part2 = x[8:16]
  #print smask_part2
  smask_part3 = x[16:24]
  #print smask_part3
  smask_part4 = x[24:32]
  #print smask_part4
  sbits1 = 0
  sbits2 = 0
  sbits3 = 0
  sbits4 = 0
  for i in range(0, 8):
    if(smask_part1[i] == "1"):
      i = i + 1
      sbits1 = int(i)
    else:
      None
  
  for i in range(0, 8):
    if(smask_part2[i] == "1"):
      i = i + 1
      sbits2 = int(i)
    else:
      None
      
  for i in range(0, 8):
    if(smask_part3[i] == "1"):
      i = i + 1
      sbits3 = int(i)
    else:
      None
      
  for i in range(0, 8):
    if(smask_part4[i] == "1"):
      i = i + 1
      sbits4 = int(i)
    else:
      None
  if(sbits1 == "" or sbits1 == 0):
    sbits1 = int(0) 
  elif(sbits2 == ""):
    sbits2 = int(0)  
  elif(sbits3 == ""):
    sbits3 = int(0)  
  elif(sbits4 == ""):
    sbits4 = int(0)   
  #print sbits1
  #print sbits2
  #print sbits3
  #print sbits4
  sbits1 = int(sbits1)
  sbits2 = int(sbits2)
  sbits3 = int(sbits3)
  sbits4 = int(sbits4)
  
  if(y == "a" or y == "A"):
    subnetbits = sbits1 + sbits2 + sbits3 + sbits4 - 8
    if(int(subnetbits) == 0):
      max_subnets = "1"
    elif(int(subnetbits) == 1):
      max_subnets = "2"
    elif(int(subnetbits) == 2):
      max_subnets = "4"
    elif(int(subnetbits) == 3):
      max_subnets = "8"
    elif(int(subnetbits) == 4):
      max_subnets = "16"
    elif(int(subnetbits) == 5):
      max_subnets = "32"
    elif(int(subnetbits) == 6):
      max_subnets = "64"
    elif(int(subnetbits) == 7):
      max_subnets = "128"
    elif(int(subnetbits) == 8):
      max_subnets = "256"
    elif(int(subnetbits) == 9):
      max_subnets = "512"
    elif(int(subnetbits) == 10):
      max_subnets = "1024"
    elif(int(subnetbits) == 11):
      max_subnets = "2048"
    elif(int(subnetbits) == 12):
      max_subnets = "4096"
    elif(int(subnetbits) == 13):
      max_subnets = "8192"
    elif(int(subnetbits) == 14):
      max_subnets = "16384"
    elif(int(subnetbits) == 15):
      max_subnets = "32768"
    elif(int(subnetbits) == 16):
      max_subnets = "65536"
    elif(int(subnetbits) == 17):
      max_subnets = "131072"
    elif(int(subnetbits) == 18):
      max_subnets = "262144"
    elif(int(subnetbits) == 19):
      max_subnets = "524288"
    elif(int(subnetbits) == 20):
      max_subnets = "1048576"
    elif(int(subnetbits) == 21):
      max_subnets = "2097152"
    elif(int(subnetbits) == 22):
      max_subnets = "4194304"
    else:
      max_subnets = "unknown"
  elif(y == "b" or y == "B"):
    subnetbits = sbits1 + sbits2 + sbits3 + sbits4 - 16
    if(int(subnetbits) == 0):
      max_subnets = "1"
    elif(int(subnetbits) == 1):
      max_subnets = "2"
    elif(int(subnetbits) == 2):
      max_subnets = "4"
    elif(int(subnetbits) == 3):
      max_subnets = "8"
    elif(int(subnetbits) == 4):
      max_subnets = "16"
    elif(int(subnetbits) == 5):
      max_subnets = "32"
    elif(int(subnetbits) == 6):
      max_subnets = "64"
    elif(int(subnetbits) == 7):
      max_subnets = "128"
    elif(int(subnetbits) == 8):
      max_subnets = "256"
    elif(int(subnetbits) == 9):
      max_subnets = "512"
    elif(int(subnetbits) == 10):
      max_subnets = "1024"
    elif(int(subnetbits) == 11):
      max_subnets = "2048"
    elif(int(subnetbits) == 12):
      max_subnets = "4096"
    elif(int(subnetbits) == 13):
      max_subnets = "8192"
    elif(int(subnetbits) == 14):
      max_subnets = "16384"
    else:
      max_subnets = "unknown"
  elif(y == "c" or y == "C"):
    subnetbits = sbits1 + sbits2 + sbits3 + sbits4 - 24
    if(int(subnetbits) == 0):
      max_subnets = "1"
    elif(int(subnetbits) == 1):
      max_subnets = "2"
    elif(int(subnetbits) == 2):
      max_subnets = "4"
    elif(int(subnetbits) == 3):
      max_subnets = "8"
    elif(int(subnetbits) == 4):
      max_subnets = "16"
    elif(int(subnetbits) == 5):
      max_subnets = "32"
    elif(int(subnetbits) == 6):
      max_subnets = "64"
    else:
      max_subnets = "unknown"
  elif(y == "d" or y == "D"):
    print "This Netclass is not defined"
  elif(y == "e" or y == "E"):
    print "This Netclass is not defined"
  else:
    print "ERROR 0x00023 Unknown netclass"
  print ("Subnetbits: " + str(subnetbits) + " max. Subnets: " + str(max_subnets))
  
   
def subnets():
  global bincode
  global binip
  submask = raw_input("Geben sie die Subnetzmaske ein: ")
  netclass = raw_input("Geben sie die Netzwerklasse ein: ")
  submask = submask.split(".") 
  binary(submask[0])
  bin1 = bincode
  bin_checker(bin1)
  bincode = ""

  #print ip[1]
  binary(submask[1])
  bin2 = bincode
  bin_checker(bin2)
  bincode = ""

  #print ip[2]
  binary(submask[2])
  bin3 = bincode
  bin_checker(bin3)
  bincode = ""

  #print ip[3]
  binary(submask[3])
  bin4 = bincode
  bin_checker(bin4)
  bincode = ""

  binip = binip[:-1]
  #print binip
  get_subnets(binip, netclass)
  temp_binip = ""
  binip = ""
  raw_input("Drücke Enter um das Programm weiter auszuführen :")
  
def get_hosts(x, y):
  #print x
  subnet = x.replace(".", "")
  sub_part1 = subnet[0:8]
  sub_part2 = subnet[8:16]
  sub_part3 = subnet[16:24]
  sub_part4 = subnet[24:32]
  #print sub_part1
  #print sub_part2
  #print sub_part3
  #print sub_part4
  sbits1 = 0
  sbits2 = 0
  sbits3 = 0
  sbits4 = 0
  for i in range(0, 8):
    if(sub_part1[i] == "1"):
      i = i + 1
      sbits1 = int(i)
    else:
      None
  
  for i in range(0, 8):
    if(sub_part2[i] == "1"):
      i = i + 1
      sbits2 = int(i)
    else:
      None
      
  for i in range(0, 8):
    if(sub_part3[i] == "1"):
      i = i + 1
      sbits3 = int(i)
    else:
      None
      
  for i in range(0, 8):
    if(sub_part4[i] == "1"):
      i = i + 1
      sbits4 = int(i)
    else:
      None
  if(sbits1 == "" or sbits1 == 0):
    sbits1 = int(0) 
  elif(sbits2 == ""):
    sbits2 = int(0)  
  elif(sbits3 == ""):
    sbits3 = int(0)  
  elif(sbits4 == ""):
    sbits4 = int(0)  
  sbits1 = 8 - sbits1
  sbits2 = 8 - sbits2
  sbits3 = 8 - sbits3
  sbits4 = 8 - sbits4
  #print sbits1
  #print sbits2
  #print sbits3
  #print sbits4 
  netclass = str("")
  subnetbits = sbits1 + sbits2 + sbits3 + sbits4 
  if(y == "a" or y == "A"):
    #subnetbits = sbits1 + sbits2 + sbits3 + sbits4 
    hosts = int(math.pow(2, int(subnetbits))) - 2
    netclass = "Netzwerkklasse A"
    #print subnetbits
  elif(y == "b" or y == "B"):
    #subnetbits = sbits1 + sbits2 + sbits3 + sbits4 
    hosts = int(math.pow(2, int(subnetbits))) - 2
    netclass = "Netzwerkklasse B"
    #print subnetbits
  elif(y == "c" or y == "C"):
    #subnetbits = sbits1 + sbits2 + sbits3 + sbits4
    hosts = int(math.pow(2, int(subnetbits))) - 2 
    netclass = "Netzwerkklasse C"
    #print subnetbits
  elif(y == "d" or y == "D"):
    print "This Netclass is not defined"
  elif(y == "e" or y == "E"):
    print "This Netclass is not defined"
  else:
    print "ERROR 0x00023 Unknown netclass"
  print netclass
  print("Hostsbits: " + str(subnetbits) + " Max hosts per subnet: " + str(hosts))
def hosts():
  global bincode
  global binip
  subnet = raw_input("Geben sie die Subnetzmaske ein: ")
  netclass = raw_input("Geben sie die Netzklasse ein: ")
  subnet = subnet.split(".")
  binary(subnet[0])
  bin1 = bincode
  bin_checker(bin1)
  bincode = ""

  #print ip[1]
  binary(subnet[1])
  bin2 = bincode
  bin_checker(bin2)
  bincode = ""

  #print ip[2]
  binary(subnet[2])
  bin3 = bincode
  bin_checker(bin3)
  bincode = ""

  #print ip[3]
  binary(subnet[3])
  bin4 = bincode
  bin_checker(bin4)
  bincode = ""

  binip = binip[:-1]
  #print binip
  get_hosts(binip, netclass)
  temp_binip = ""
  binip = ""
  raw_input("Drücke Enter um das Programm weiter auszuführen :")
  
def del_values():
  global bincode
  global temp
  global bincodepart
  global binip
  global netid
  global bcast
  temp = ""
  bincodepart = ""
  bincode = ""
  binip = ""
  netid = ""
  bcast = ""
def banner():
	if(os.name == "nt"):
		os.system("cls")
	elif(os.system == "posix"):
		os.system("clear")
	print"+------------------------------------------------+"
	print"|                                                |"
	print"|      ####  #  #  ###  #   #  ####  #####       |"
	print"|     #      #  #  #  # ##  #  #       #         |"
	print"|      ####  #  #  ###  # # #  ####    #         |"
	print"|          # #  #  #  # #  ##  #       #         |"
	print"|      ####   ##   ###  #   #  ####    #         |"
	print"|------------------------------------------------|"
	print"|   For all python users                         |"
	print"|                                                |"
	print"+------------------------------------------------+"
while running:   
	banner()
	print "(1) Netz-ID und Broadcast"
	print "(2) Anzahl der Subnetze"
	print "(3) Anzahl der Hosts/Subnetz"
	print "(99) Exit"
	cmd = raw_input("Choice > ")
	if(cmd == "1"):
		netid_broadcast()
	elif(cmd == "2"):
		subnets()
	elif(cmd == "3"):
		hosts()
	elif(cmd == "99"):
		running = False
	else:
		None

This post has been edited 2 time(s), it was last edited by DrW3sk3r: 31.01.2015 15:41.

31.01.2015 15:39 DrW3sk3r is offline Send an Email to DrW3sk3r Search for Posts by DrW3sk3r Add DrW3sk3r to your Buddy List
Tree Structure | Board Structure
Jump to:
Post New Thread Post Reply

Suche Hackersoftware/Hackertools (: Software)   17.12.2010 21:01 Congo   8,186 4   11.04.2013 17:19 DrW3sk3r  
Hack Tool Programm Software Bruter zum Passwort knacke [...] (: Applications / Tools)   16.10.2011 17:22 Congo   16,213 6   26.12.2011 16:11 Nojoke84  
TOOL: Suche TOOL zum knacken von jedem möglichen Passwort (: Software)   02.10.2010 23:17 Congo   5,423 2   09.10.2010 11:52 green1  
toolstar hspu (: Applications / Tools)   22.09.2007 17:29 krümel   13,419 10   10.02.2010 19:39 DarkSquirrel  
Alle möglicen Toolz (: Applications / Tools)   23.06.2007 15:58 Tommy1000   9,342 4   27.06.2007 11:45 Tommy1000  

HackBox Forum » Computer & Co » Software » Subnetting tool

Views heute: 6.714 | Views gestern: 10.167 | Views gesamt: 58.474.821


© • www.hackbox.de forum.hackbox.de
Forum Software: Burning Board 2.3.6 pl2, Developed by WoltLab GmbH
DB: 141.463s | DB-Abfragen: 60 | Gesamt: 0.217s | PHP: -65090.32% | SQL: 65190.32%