arialdomartini / morris-worm Goto Github PK
View Code? Open in Web Editor NEWThe decompiled Morris Worm source code
The decompiled Morris Worm source code
Entirely for experimentation purposes, but how are you supposed to run it. Sorry if dumb question. Am an amateur.
Hi,
It's a great project, thanks for putting it up here!
But I'm sure every visitor could benefit from a little more details!
Thanks in advance!
(I found out about this project from this article)
So, on Colab, I run !make
and here's the result
!make
cc -c -o worm.o worm.c
In file included from worm.c:3:
worm.h:43:8: warning: type defaults to ‘int’ in declaration of ‘nifs’ [-Wimplicit-int]
43 | extern nifs;
| ^~~~
worm.c:18:8: warning: type defaults to ‘int’ in declaration of ‘errno’ [-Wimplicit-int]
18 | extern errno;
| ^~~~~
worm.c:19:14: warning: conflicting types for built-in function ‘malloc’; expected ‘void *(long unsigned int)’ [-Wbuiltin-declaration-mismatch]
19 | extern char *malloc();
| ^~~~~~
worm.c:17:1: note: ‘malloc’ is declared in header ‘<stdlib.h>’
16 | #include <arpa/inet.h>
+++ |+#include <stdlib.h>
17 |
worm.c:32:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
32 | main(argc, argv) /* 0x20a0 */
| ^~~~
worm.c: In function ‘main’:
worm.c:42:5: warning: implicit declaration of function ‘strcpy’ [-Wimplicit-function-declaration]
42 | strcpy(argv[0], XS("sh")); /* <env+52> */
| ^~~~~~
worm.c:17:1: note: include ‘<string.h>’ or provide a declaration of ‘strcpy’
16 | #include <arpa/inet.h>
+++ |+#include <string.h>
17 |
worm.c:42:5: warning: incompatible implicit declaration of built-in function ‘strcpy’ [-Wbuiltin-declaration-mismatch]
42 | strcpy(argv[0], XS("sh")); /* <env+52> */
| ^~~~~~
worm.c:42:5: note: include ‘<string.h>’ or provide a declaration of ‘strcpy’
worm.c:43:5: warning: implicit declaration of function ‘time’; did you mean ‘utimes’? [-Wimplicit-function-declaration]
43 | time(&key);
| ^~~~
| utimes
worm.c:44:5: warning: implicit declaration of function ‘srandom’ [-Wimplicit-function-declaration]
44 | srandom(key);
| ^~~~~~~
worm.c:53:10: warning: implicit declaration of function ‘strcmp’ [-Wimplicit-function-declaration]
53 | strcmp(argv[cur_arg], XS("-p")) == 0) { /* env55 == "-p" */
| ^~~~~~
worm.c:53:10: note: include ‘<string.h>’ or provide a declaration of ‘strcmp’
worm.c:54:19: warning: implicit declaration of function ‘atoi’ [-Wimplicit-function-declaration]
54 | pid_arg = atoi(argv[2]);
| ^~~~
worm.c:58:13: warning: implicit declaration of function ‘loadobject’ [-Wimplicit-function-declaration]
58 | if (loadobject(argv[i]) == 0)
| ^~~~~~~~~~
worm.c:59:13: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
59 | exit(1);
| ^~~~
worm.c:59:13: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
worm.c:59:13: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
worm.c:59:13: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
worm.c:61:13: warning: implicit declaration of function ‘unlink’ [-Wimplicit-function-declaration]
61 | unlink(argv[i]);
| ^~~~~~
worm.c:64:9: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
64 | exit(1);
| ^~~~
worm.c:64:9: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
worm.c:67:13: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration]
67 | close(i);
| ^~~~~
| pclose
worm.c:77:9: warning: implicit declaration of function ‘if_init’ [-Wimplicit-function-declaration]
77 | if (if_init() == 0)
| ^~~~~~~
worm.c:78:9: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
78 | exit(1);
| ^~~~
worm.c:78:9: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
worm.c:80:24: warning: implicit declaration of function ‘getpgrp’ [-Wimplicit-function-declaration]
80 | if (pid_arg == getpgrp(getpid()))
| ^~~~~~~
worm.c:80:32: warning: implicit declaration of function ‘getpid’ [-Wimplicit-function-declaration]
80 | if (pid_arg == getpgrp(getpid()))
| ^~~~~~
worm.c:81:13: warning: implicit declaration of function ‘setpgrp’ [-Wimplicit-function-declaration]
81 | setpgrp(getpid(), getpid());
| ^~~~~~~
worm.c:84:5: warning: implicit declaration of function ‘mainloop’ [-Wimplicit-function-declaration]
84 | mainloop();
| ^~~~~~~~
worm.c: At top level:
worm.c:87:8: warning: return type defaults to ‘int’ [-Wimplicit-int]
87 | static mainloop() /* 0x2302 */
| ^~~~~~~~
worm.c:87:8: error: static declaration of ‘mainloop’ follows non-static declaration
worm.c:84:5: note: previous implicit declaration of ‘mainloop’ with type ‘int()’
84 | mainloop();
| ^~~~~~~~
worm.c: In function ‘mainloop’:
worm.c:94:9: warning: implicit declaration of function ‘hg’ [-Wimplicit-function-declaration]
94 | if (hg() == 0 && hl() == 0)
| ^~
worm.c:94:22: warning: implicit declaration of function ‘hl’ [-Wimplicit-function-declaration]
94 | if (hg() == 0 && hl() == 0)
| ^~
worm.c:95:9: warning: implicit declaration of function ‘ha’ [-Wimplicit-function-declaration]
95 | ha();
| ^~
worm.c:96:5: warning: implicit declaration of function ‘checkother’ [-Wimplicit-function-declaration]
96 | checkother();
| ^~~~~~~~~~
worm.c:97:5: warning: implicit declaration of function ‘report_breakin’ [-Wimplicit-function-declaration]
97 | report_breakin();
| ^~~~~~~~~~~~~~
worm.c:98:5: warning: implicit declaration of function ‘cracksome’ [-Wimplicit-function-declaration]
98 | cracksome();
| ^~~~~~~~~
worm.c:99:5: warning: implicit declaration of function ‘other_sleep’ [-Wimplicit-function-declaration]
99 | other_sleep(30);
| ^~~~~~~~~~~
worm.c:104:13: warning: implicit declaration of function ‘fork’ [-Wimplicit-function-declaration]
104 | if (fork() > 0)
| ^~~~
worm.c:105:13: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
105 | exit(0);
| ^~~~
worm.c:105:13: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
worm.c:106:26: warning: implicit declaration of function ‘hi’ [-Wimplicit-function-declaration]
106 | if (hg() == 0 && hi() == 0 && ha() == 0)
| ^~
worm.c:111:13: warning: implicit declaration of function ‘h_clean’ [-Wimplicit-function-declaration]
111 | h_clean();
| ^~~~~~~
worm.c:113:13: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
113 | exit(0);
| ^~~~
worm.c:113:13: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
worm.c: At top level:
worm.c:117:8: warning: type defaults to ‘int’ in declaration of ‘trans_cnt’ [-Wimplicit-int]
117 | static trans_cnt;
| ^~~~~~~~~
worm.c:143:8: warning: return type defaults to ‘int’ [-Wimplicit-int]
143 | static report_breakin(arg1, arg2) /* 0x2494 */
| ^~~~~~~~~~~~~~
worm.c:143:8: error: static declaration of ‘report_breakin’ follows non-static declaration
worm.c:97:5: note: previous implicit declaration of ‘report_breakin’ with type ‘int()’
97 | report_breakin();
| ^~~~~~~~~~~~~~
worm.c: In function ‘report_breakin’:
worm.c:143:8: warning: type of ‘arg1’ defaults to ‘int’ [-Wimplicit-int]
143 | static report_breakin(arg1, arg2) /* 0x2494 */
| ^~~~~~~~~~~~~~
worm.c:143:8: warning: type of ‘arg2’ defaults to ‘int’ [-Wimplicit-int]
worm.c:149:14: warning: implicit declaration of function ‘random’ [-Wimplicit-function-declaration]
149 | if (7 != random() % 15)
| ^~~~~~
worm.c:150:9: warning: ‘return’ with no value, in function returning non-void
150 | return;
| ^~~~~~
worm.c:143:8: note: declared here
143 | static report_breakin(arg1, arg2) /* 0x2494 */
| ^~~~~~~~~~~~~~
worm.c:160:9: warning: ‘return’ with no value, in function returning non-void
160 | return;
| ^~~~~~
worm.c:143:8: note: declared here
143 | static report_breakin(arg1, arg2) /* 0x2494 */
| ^~~~~~~~~~~~~~
worm.c:161:31: warning: passing argument 5 of ‘sendto’ from incompatible pointer type [-Wincompatible-pointer-types]
161 | if (sendto(s, &msg, 1, 0, &sin, sizeof(sin)))
| ^~~~
| |
| struct sockaddr_in *
In file included from worm.c:11:
/usr/include/x86_64-linux-gnu/sys/socket.h:153:58: note: expected ‘const struct sockaddr *’ but argument is of type ‘struct sockaddr_in *’
153 | int __flags, __CONST_SOCKADDR_ARG __addr,
| ^
make: *** [<builtin>: worm.o] Error 1
This is basically the error code I've got each time I tried over the years.
This is not the original code, it is lifted from one of the decompilation projects (I haven't dug in to which one but it's kind of obvious, since it has the xNNN pathnames and commented bug fixes.)
Maybe it's time to rework this code into something more modern.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.