66using System . Text ;
77using XNA = Microsoft . Xna . Framework ;
88
9- namespace OpenAllPortsMod
9+ namespace DebugMod
1010{
1111 static class Commands
1212 {
@@ -66,7 +66,61 @@ public static bool OpenAllPorts(Hacknet.OS os, List<string> args)
6666 }
6767 return false ;
6868 }
69-
69+ public static bool CloseAllPorts ( Hacknet . OS os , List < string > args )
70+ {
71+ string ip = os . thisComputer . ip ;
72+ Computer computer = os . connectedComp ;
73+ Console . WriteLine ( computer . ports ) ;
74+ if ( computer . ports . Contains ( 22 ) )
75+ {
76+ computer . closePort ( 22 , ip ) ;
77+ }
78+ if ( computer . ports . Contains ( 21 ) )
79+ {
80+ computer . closePort ( 21 , ip ) ;
81+ }
82+ if ( computer . ports . Contains ( 25 ) )
83+ {
84+ computer . closePort ( 25 , ip ) ;
85+ }
86+ if ( computer . ports . Contains ( 80 ) )
87+ {
88+ computer . closePort ( 80 , ip ) ;
89+ }
90+ if ( computer . ports . Contains ( 1433 ) )
91+ {
92+ computer . closePort ( 1433 , ip ) ;
93+ }
94+ if ( computer . ports . Contains ( 3724 ) )
95+ {
96+ computer . closePort ( 3724 , ip ) ;
97+ }
98+ if ( computer . ports . Contains ( 104 ) )
99+ {
100+ computer . closePort ( 104 , ip ) ;
101+ }
102+ if ( computer . ports . Contains ( 3659 ) )
103+ {
104+ computer . closePort ( 3659 , ip ) ;
105+ }
106+ if ( computer . ports . Contains ( 192 ) )
107+ {
108+ computer . closePort ( 192 , ip ) ;
109+ }
110+ if ( computer . ports . Contains ( 6881 ) )
111+ {
112+ computer . closePort ( 6881 , ip ) ;
113+ }
114+ if ( computer . ports . Contains ( 443 ) )
115+ {
116+ computer . closePort ( 443 , ip ) ;
117+ }
118+ if ( computer . ports . Contains ( 9418 ) )
119+ {
120+ computer . closePort ( 9418 , ip ) ;
121+ }
122+ return false ;
123+ }
70124 public static bool BypassProxy ( Hacknet . OS os , List < string > args )
71125 {
72126 Computer computer = os . connectedComp ;
@@ -152,22 +206,7 @@ public static bool AddIRCMessage(Hacknet.OS os, List<string> args)
152206 {
153207 string computer = args [ 1 ] ;
154208 string author = args [ 2 ] ;
155- string messageInput1 = args [ 3 ] ;
156- string messageInput2 = args [ 4 ] ;
157- string messageInput3 = args [ 5 ] ;
158- string messageInput4 = args [ 6 ] ;
159- string messageInput5 = args [ 7 ] ;
160- string messageInput6 = args [ 8 ] ;
161- string messageInput7 = args [ 9 ] ;
162- string messageInput8 = args [ 10 ] ;
163- string messageInput9 = args [ 11 ] ;
164- string messageInput10 = args [ 12 ] ;
165- string messageInput11 = args [ 13 ] ;
166- string messageInput12 = args [ 14 ] ;
167- string messageInput13 = args [ 15 ] ;
168- string messageInput14 = args [ 16 ] ;
169- string message = messageInput1 + messageInput2 + messageInput3 + messageInput4 + messageInput5 + messageInput6 + messageInput7 + messageInput8 + messageInput9 + messageInput10 + messageInput11 + messageInput12 + messageInput13 + messageInput14 ;
170-
209+ string message = args [ 3 ] ;
171210 if ( args . Count < 3 )
172211 {
173212 os . write ( "Usage: addIRCMessage (ComputerID) (Author) (Message)" ) ;
@@ -180,12 +219,12 @@ public static bool AddIRCMessage(Hacknet.OS os, List<string> args)
180219 }
181220 public static bool StrikerAttack ( Hacknet . OS os , List < string > args )
182221 {
183- HackerScriptExecuter . runScript ( "DLC/ActionScripts/Hackers/SystemHack.txt" , os , ( string ) null ) ;
222+ HackerScriptExecuter . runScript ( "DLC/ActionScripts/Hackers/SystemHack.txt" , ( object ) os , ( string ) null , ( string ) null ) ;
184223 return false ;
185224 }
186225 public static bool ThemeAttack ( Hacknet . OS os , List < string > args )
187226 {
188- HackerScriptExecuter . runScript ( "HackerScripts/ThemeHack.txt" , os , ( string ) null ) ;
227+ HackerScriptExecuter . runScript ( "HackerScripts/ThemeHack.txt" , ( object ) os , ( string ) null , ( string ) null ) ;
189228 return false ;
190229 }
191230 public static bool CallThePoliceSoTheyCanTraceYou ( Hacknet . OS os , List < string > args )
@@ -335,13 +374,19 @@ public static bool DeleteWhitelistDLL(Hacknet.OS os, List<string> args)
335374 List < int > FolderPath = new List < int > ( ) ;
336375 FolderPath . Add ( 5 ) ;
337376 Folder folder = computer . files . root . searchForFolder ( "Whitelist" ) ;
377+
338378 folder . files . Remove ( folder . files [ 0 ] ) ;
339379 return false ;
340380 }
341381 public static bool ChangeMusic ( Hacknet . OS os , List < string > args )
342382 {
343- string song = args [ 1 ] ;
344- MusicManager . playSongImmediatley ( "Content\\ " + song ) ;
383+ string SongInput = args [ 1 ] ;
384+ string Song = args [ 1 ] . Replace ( "/" , "\\ " ) ;
385+ if ( Song == SongInput )
386+ {
387+ Song = args [ 1 ] . Replace ( "\\ " , "\\ " ) ;
388+ }
389+ MusicManager . playSongImmediatley ( Song ) ;
345390 return false ;
346391 }
347392 public static bool CrashComputer ( Hacknet . OS os , List < string > args )
@@ -396,77 +441,142 @@ public static bool AddUser(Hacknet.OS os, List<string> args)
396441 computer . addNewUser ( os . thisComputer . ip , Username , Password , Type ) ;
397442 return false ;
398443 }
399- public static bool OpenPort ( Hacknet . OS os , List < string > args )
444+ /* public static bool OpenPort(Hacknet.OS os, List<string> args)
400445 {
401446 int port = Convert.ToInt32(args[1]);
402- Computer computer = os . thisComputer ;
403- computer . openPort ( port , os . thisComputer . ip ) ;
447+ string ip = os.thisComputer.ip;
448+ Computer computer = os.connectedComp;
449+ Console.WriteLine(computer.ports);
450+ if (port == 22)
451+ {
452+ computer.openPort(22, ip);
453+ }
454+ else if (port == 21)
455+ {
456+ computer.openPort(21, ip);
457+ }
458+ else if (port == 25)
459+ {
460+ computer.openPort(25, ip);
461+ }
462+ else if (port == 80)
463+ {
464+ computer.openPort(80, ip);
465+ }
466+ else if (port == 1433)
467+ {
468+ computer.openPort(1433, ip);
469+ }
470+ else if (port == 3724)
471+ {
472+ computer.openPort(3724, ip);
473+ }
474+ else if (port == 104)
475+ {
476+ computer.openPort(104, ip);
477+ }
478+ else if (port == 3659)
479+ {
480+ computer.openPort(3659, ip);
481+ }
482+ else if (port == 192)
483+ {
484+ computer.openPort(192, ip);
485+ }
486+ else if (port == 6881)
487+ {
488+ computer.openPort(6881, ip);
489+ }
490+ else if (port == 443)
491+ {
492+ computer.openPort(443, ip);
493+ }
494+ else if (port == 9418)
495+ {
496+ computer.openPort(9418, ip);
497+ }
404498 return false;
405499 }
406- public static bool CloseAllPorts ( Hacknet . OS os , List < string > args )
500+ public static bool ClosePort (Hacknet.OS os, List<string> args)
407501 {
502+ int port = Convert.ToInt32(args[1]);
408503 string ip = os.thisComputer.ip;
409504 Computer computer = os.connectedComp;
410505 Console.WriteLine(computer.ports);
411- if ( computer . ports . Contains ( 22 ) )
506+ if (port == 22 )
412507 {
413508 computer.closePort(22, ip);
414509 }
415- if ( computer . ports . Contains ( 21 ) )
510+ else if (port == 21 )
416511 {
417512 computer.closePort(21, ip);
418513 }
419- if ( computer . ports . Contains ( 25 ) )
514+ else if (port == 25 )
420515 {
421516 computer.closePort(25, ip);
422517 }
423- if ( computer . ports . Contains ( 80 ) )
518+ else if (port == 80 )
424519 {
425520 computer.closePort(80, ip);
426521 }
427- if ( computer . ports . Contains ( 1433 ) )
522+ else if (port == 1433)
428523 {
429524 computer.closePort(1433, ip);
430525 }
431- if ( computer . ports . Contains ( 3724 ) )
526+ else if (port == 3724)
432527 {
433528 computer.closePort(3724, ip);
434529 }
435- if ( computer . ports . Contains ( 104 ) )
530+ else if (port == 104)
436531 {
437532 computer.closePort(104, ip);
438533 }
439- if ( computer . ports . Contains ( 3659 ) )
534+ else if (port == 3659)
440535 {
441536 computer.closePort(3659, ip);
442537 }
443- if ( computer . ports . Contains ( 192 ) )
538+ else if (port == 192)
444539 {
445540 computer.closePort(192, ip);
446541 }
447- if ( computer . ports . Contains ( 6881 ) )
542+ else if (port == 6881)
448543 {
449544 computer.closePort(6881, ip);
450545 }
451- if ( computer . ports . Contains ( 443 ) )
546+ else if (port == 443)
452547 {
453548 computer.closePort(443, ip);
454549 }
455- if ( computer . ports . Contains ( 9418 ) )
550+ else if (port == 9418)
456551 {
457552 computer.closePort(9418, ip);
458553 }
459554 return false;
555+ } */
556+ public static bool OpenPort ( Hacknet . OS os , List < string > args )
557+ {
558+ Computer computer = os . connectedComp ;
559+ if ( args . Count < 1 )
560+ {
561+ os . write ( "Usage: openPort (PortToopen)" ) ;
562+ return false ;
563+ }
564+ int port = Convert . ToInt32 ( args [ 1 ] ) ;
565+ string ip = os . thisComputer . ip ;
566+ computer . openPort ( port , ip ) ;
567+ return false ;
460568 }
461569 public static bool ClosePort ( Hacknet . OS os , List < string > args )
462570 {
463571 Computer computer = os . connectedComp ;
464572 if ( args . Count < 1 )
465573 {
466- os . write ( "Usage: closePort (PortToClose)" ) ;
574+ os . write ( "Usage: closePort (PortToClose)\n " ) ;
467575 return false ;
468576 }
469577 int port = Convert . ToInt32 ( args [ 1 ] ) ;
578+ string ip = os . thisComputer . ip ;
579+ computer . closePort ( port , ip ) ;
470580 return false ;
471581 }
472582 public static bool RemoveProxy ( Hacknet . OS os , List < string > args )
@@ -874,6 +984,86 @@ public static bool AddAgentToIRC(Hacknet.OS os, List<string> args)
874984 IRC . AddAgent ( args [ 2 ] , args [ 3 ] , colour ) ;
875985 return false ;
876986 }
877-
987+ public static bool SetCompPorts ( Hacknet . OS os , List < string > args )
988+ {
989+ Computer computer = Programs . getComputer ( os , args [ 1 ] ) ;
990+ ComputerLoader . loadPortsIntoComputer ( args [ 2 ] , computer ) ;
991+ return false ;
992+ }
993+ /*public static bool RemovePortFromComp(Hacknet.OS os, List<string> args) Not used, probably should be removed
994+ {
995+ Computer computer = Programs.getComputer(os, args[1]);
996+ computer.ports.Remove(Convert.ToInt32(args[2]));
997+ return false;
998+ }
999+ public static bool AddCustomPortToComp(Hacknet.OS os, List<string> args) Untested, test and release when pathfinder 3.0 comes out
1000+ {
1001+ Computer computer = Programs.getComputer(os, args[1]);
1002+ Pathfinder.Port.PortType port = new Pathfinder.Port.PortType(args[2], Convert.ToUInt32(args[3]));
1003+ port.AssignTo(computer, false);
1004+ Pathfinder.Port.Handler.AddPort(port.PortId, port);
1005+ return false;
1006+ }
1007+ public static bool RemoveCustomPortFromComp(Hacknet.OS os, List<string> args) IDK how to do this.......
1008+ {
1009+ Computer computer = Programs.getComputer(os, args[1]);
1010+ Pathfinder.Computer.Extensions.GetModdedPortList(computer);
1011+ return false;
1012+ } */
1013+ public static bool AddSongChangerDaemon ( Hacknet . OS os , List < string > args )
1014+ {
1015+ Computer computer = Programs . getComputer ( os , args [ 1 ] ) ;
1016+ SongChangerDaemon daemon = new SongChangerDaemon ( computer , os ) ;
1017+ computer . daemons . Add ( daemon ) ;
1018+ return false ;
1019+ }
1020+ public static bool AddRicerConnectDaemon ( Hacknet . OS os , List < string > args )
1021+ {
1022+ Computer computer = Programs . getComputer ( os , args [ 1 ] ) ;
1023+ CustomConnectDisplayDaemon daemon = new CustomConnectDisplayDaemon ( computer , os ) ;
1024+ computer . daemons . Add ( daemon ) ;
1025+ return false ;
1026+ }
1027+ public static bool AddDLCCreditsDaemon ( Hacknet . OS os , List < string > args )
1028+ {
1029+ Computer computer = Programs . getComputer ( os , args [ 1 ] ) ;
1030+ DLCCreditsDaemon daemon = new DLCCreditsDaemon ( computer , os ) ;
1031+ computer . daemons . Add ( daemon ) ;
1032+ return false ;
1033+ }
1034+ public static bool AddIRCDaemon ( Hacknet . OS os , List < string > args )
1035+ {
1036+ Computer computer = Programs . getComputer ( os , args [ 1 ] ) ;
1037+ IRCDaemon daemon = new IRCDaemon ( computer , os , args [ 2 ] ) ;
1038+ computer . daemons . Add ( daemon ) ;
1039+ return false ;
1040+ }
1041+ public static bool AddISPDaemon ( Hacknet . OS os , List < string > args )
1042+ {
1043+ Computer computer = Programs . getComputer ( os , args [ 1 ] ) ;
1044+ ISPDaemon daemon = new ISPDaemon ( computer , os ) ;
1045+ computer . daemons . Add ( daemon ) ;
1046+ return false ;
1047+ }
1048+ public static bool Quit ( Hacknet . OS os , List < string > args )
1049+ {
1050+ Game1 . getSingleton ( ) . Exit ( ) ;
1051+ return false ;
1052+ }
1053+ public static bool DeleteLogs ( Hacknet . OS os , List < string > args )
1054+ {
1055+ Computer computer = Programs . getComputer ( os , args [ 1 ] ) ;
1056+ Console . WriteLine ( "Computer object obtained" ) ;
1057+ Folder folder = computer . files . root . searchForFolder ( "log" ) ;
1058+ Console . WriteLine ( "Folder object obtained" ) ;
1059+ folder . files . Clear ( ) ;
1060+ Console . WriteLine ( "Deleted all logs" ) ;
1061+ return false ;
1062+ }
1063+ public static bool ForkbombProof ( Hacknet . OS os , List < string > args )
1064+ {
1065+ os . totalRam = 1000000000 ;
1066+ return false ;
1067+ }
8781068 }
8791069}
0 commit comments