~/NobodyFirewall# make gcc -lpcap -lpthread nfwall.c -o nfwall nfwall.c: In function ‘main’: nfwall.c:96:3: warning: too many arguments for format [-Wformat-extra-args] printf("[!] Warning: Using default interface: \"%s\".\n\n", iface, argv[0]); ^ nfwall.c: In function ‘ProcessSAMPPacket’: nfwall.c:179:3: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c:179:3: note: use option -std=c99 or -std=gnu99 to compile your code nfwall.c: In function ‘ProcessCookiePacket’: nfwall.c:205:3: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c: In function ‘CheckIfExists’: nfwall.c:236:2: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c: In function ‘threadReload’: nfwall.c:246:2: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ make: *** [all] Error 1
Nice - I kinda of need this at the moment, but whenever I try to make it (and after installing all the dependencies prior to trying), i get this output while "make":
Code:
~/NobodyFirewall# make gcc -lpcap -lpthread nfwall.c -o nfwall nfwall.c: In function ‘main’: nfwall.c:96:3: warning: too many arguments for format [-Wformat-extra-args] printf("[!] Warning: Using default interface: \"%s\".\n\n", iface, argv[0]); ^ nfwall.c: In function ‘ProcessSAMPPacket’: nfwall.c:179:3: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c:179:3: note: use option -std=c99 or -std=gnu99 to compile your code nfwall.c: In function ‘ProcessCookiePacket’: nfwall.c:205:3: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c: In function ‘CheckIfExists’: nfwall.c:236:2: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c: In function ‘threadReload’: nfwall.c:246:2: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ make: *** [all] Error 1 |
~/NobodyFirewall# make gcc -lpcap -lpthread nfwall.c -o nfwall make: gcc: Command not found Makefile:2: recipe for target 'all' failed make: *** [all] Error 127
Code:
~/NobodyFirewall# make gcc -lpcap -lpthread nfwall.c -o nfwall make: gcc: Command not found Makefile:2: recipe for target 'all' failed make: *** [all] Error 127 |
What version of gcc do you currently have installed?
Also you can just add '-std=c99' to the makefile in order to invoke a C99 compiler. Calling /usr/bin/c99 instead of /usr/bin/gcc on an Ubuntu system, this points to a script which invokes gcc after having added the -std=c99 flag, which is precisely what you want |
~/NobodyFirewall# make gcc -lpcap -lpthread nfwall.c -o nfwall nfwall.c: In function ‘main’: nfwall.c:96:10: warning: too many arguments for format [-Wformat-extra-args] printf("[!] Warning: Using default interface: \"%s\".\n\n", iface, argv[0]); ^ /tmp/ccjeHIRl.o: In function `main': nfwall.c:(.text+0x4b): undefined reference to `pthread_create' nfwall.c:(.text+0x1ca): undefined reference to `pcap_findalldevs' nfwall.c:(.text+0x23c): undefined reference to `pcap_open_live' nfwall.c:(.text+0x295): undefined reference to `pcap_setdirection' nfwall.c:(.text+0x2b3): undefined reference to `pcap_loop' collect2: error: ld returned 1 exit status Makefile:2: recipe for target 'all' failed make: *** [all] Error 1
Nice - I kinda of need this at the moment, but whenever I try to make it (and after installing all the dependencies prior to trying), i get this output while "make":
Code:
~/NobodyFirewall# make gcc -lpcap -lpthread nfwall.c -o nfwall nfwall.c: In function ‘main’: nfwall.c:96:3: warning: too many arguments for format [-Wformat-extra-args] printf("[!] Warning: Using default interface: \"%s\".\n\n", iface, argv[0]); ^ nfwall.c: In function ‘ProcessSAMPPacket’: nfwall.c:179:3: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c:179:3: note: use option -std=c99 or -std=gnu99 to compile your code nfwall.c: In function ‘ProcessCookiePacket’: nfwall.c:205:3: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c: In function ‘CheckIfExists’: nfwall.c:236:2: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ nfwall.c: In function ‘threadReload’: nfwall.c:246:2: error: ‘for’ loop initial declarations are only allowed in C99 m ode for (int i = 0; i < STRUCT_NUMBER; i++) ^ make: *** [all] Error 1 |
Code:
~/NobodyFirewall# make gcc -lpcap -lpthread nfwall.c -o nfwall nfwall.c: In function ‘main’: nfwall.c:96:10: warning: too many arguments for format [-Wformat-extra-args] printf("[!] Warning: Using default interface: \"%s\".\n\n", iface, argv[0]); ^ /tmp/ccjeHIRl.o: In function `main': nfwall.c:(.text+0x4b): undefined reference to `pthread_create' nfwall.c:(.text+0x1ca): undefined reference to `pcap_findalldevs' nfwall.c:(.text+0x23c): undefined reference to `pcap_open_live' nfwall.c:(.text+0x295): undefined reference to `pcap_setdirection' nfwall.c:(.text+0x2b3): undefined reference to `pcap_loop' collect2: error: ld returned 1 exit status Makefile:2: recipe for target 'all' failed make: *** [all] Error 1 |
Cool Idea,
But one problem is the loopback address can be faked, and any experienced programmer with some hacking knowledge will know this. Don't ignore any address, treat all as a possible threat. I am an experienced Ethical Hacker / Software and Network Engineer and I myself have made the same mistake a couple of years ago, so maybe update the code to not ignore the loopback address. |
Try the new version i uploaded right now, you don't need to use c99 compiler.
Try to use -pthread instead of -lpthread in Makefile. Anyway, i edited Makefile in the new version, you can try with it. Take a look to Martian packet and Bogon filtering. Best Regards! |
Whoops, I apologize I overlooked the part of code where you were using this system. I am aware of this type of filtering, something I had to learn a few years ago when I first starting working for IBM.
Good Work, though. |
Nobody's Firewall Current version: 0.1 BETA FIX #2.Simple firewall that protect your server against query/cookie flood. ••• Description ••• Nobody Firewall (aka nfwall) is a simple —but powerful— firewall for SA-MP that protect your server against query flood/cookie flood attacks. ••• Why? ••• I didn't program for some years ago and i've retired from SA-MP. Recently a friend asked me for help with pawn and... I don't know, simply i want'd to program in C again and i noticed that the actual anti 'server full' attacks haven't been updated for some months, so i decided to work in a new firewall that protect the servers against known query flood and the cookie flood for SA-MP 0.3.7. ••• Features ••• • Open Source. • Programmed purely in C. • Use lipbcap. • Ban logs. • Debug mode. • Actually runs only on Linux (i will relese a multi-so version soon). ••• Dependences ••• • libpcap. (https://github.com/the-tcpdump-group/libpcap) ••• Downloads ••• https://github.com/n0bodysec/NobodyFirewall Licensed under GNU General Public License v3. ••• Special thanks ••• • n3ptun0 (aka Stella) for his firewall for SA-MP 0.3e. • Silver Moon for his base code. Y̶u̶p̶,̶ ̶a̶ ̶p̶o̶o̶r̶ ̶p̶o̶s̶t̶.̶ Greetings! Nobody. |
I think this is a bit unnecessary since it is possible to do the control you did using iptables with the recent module!
But anyway congratulations! Good job ! |