0fc5d6b01c
traceroute, and nmap, hping can be used to traceroute through packet filtering routers. Among other things.
39 lines
895 B
Text
39 lines
895 B
Text
$NetBSD: patch-aa,v 1.1.1.1 2002/04/04 17:02:30 atatat Exp $
|
|
|
|
Do *ALL* the root stuff right up front and then completely lose
|
|
privileges.
|
|
|
|
--- main.c.orig Mon Aug 13 20:07:33 2001
|
|
+++ main.c Fri Mar 29 23:46:01 2002
|
|
@@ -150,6 +150,17 @@
|
|
char setflags[1024] = {'\0'};
|
|
int c, hdr_size;
|
|
|
|
+ /* open raw socket */
|
|
+ sockraw = open_sockraw();
|
|
+ if (sockraw == -1) {
|
|
+ printf("[main] can't open raw socket\n");
|
|
+ exit(1);
|
|
+ }
|
|
+ if (getuid() && setuid(getuid()) == -1) {
|
|
+ printf("[main] can't drop privs\n");
|
|
+ exit(1);
|
|
+ }
|
|
+
|
|
if ( parse_options(argc, argv) == -1 )
|
|
{
|
|
printf("hping2: missing host argument\n"
|
|
@@ -187,13 +199,6 @@
|
|
{
|
|
printf("using %s, addr: %s, MTU: %d\n",
|
|
ifname, ifstraddr, h_if_mtu);
|
|
- }
|
|
-
|
|
- /* open raw socket */
|
|
- sockraw = open_sockraw();
|
|
- if (sockraw == -1) {
|
|
- printf("[main] can't open raw socket\n");
|
|
- exit(1);
|
|
}
|
|
|
|
/* set SO_BROADCAST option */
|