Skip to content

Commit bc2e2f2

Browse files
author
enderunix
committed
Knowlan
0 parents  commit bc2e2f2

File tree

9 files changed

+1032
-0
lines changed

9 files changed

+1032
-0
lines changed

COPYING

+340
Large diffs are not rendered by default.

ChangeLog

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-----------------------------------------------------
2+
EnderUnix Knowlan - 0.1.1
3+
Halil Demirezen <[email protected]
4+
-----------------------------------------------------
5+
6+
Sat, 10-01-2004 01:45:24 - Halil Demirezen <[email protected]>
7+
8+
Package: knowlan, Version: 0.1.1
9+
10+
* Pipeable output provided.
11+
12+
13+
Fri, 19-09-2003 14:53:00 - Halil Demirezen <[email protected]>
14+
15+
Package: knowlan, Version: 0.1
16+
17+
* Initial Release
18+
19+

INSTALL

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-----------------------------------------------------
2+
EnderUnix Knowlan - 0.1
3+
Halil Demirezen <[email protected]
4+
-----------------------------------------------------
5+
6+
Depending on being initial, knowlan can easily be
7+
installed. First of all,
8+
9+
10+
./configure
11+
12+
13+
Then,
14+
15+
make, make install
16+
17+
so knowlan is at your service.
18+
19+
Not to get boring errors, check your libpcap-dev and
20+
libnet-dev to be installed correctly.
21+
22+
23+

README

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
-----------------------------------------------------
2+
EnderUnix Knowlan - 0.1
3+
Halil Demirezen <[email protected]
4+
-----------------------------------------------------
5+
6+
7+
Knowlan is ARP protocol based Local Area Network IP and
8+
MAC Adress Extractor. Knowlan uses libpcap and libnet
9+
libraries for to be simple to handle and to have a simple
10+
code for any interestor to deal with the code. Pre-Stable
11+
Versions of Knowlan did not use libpcap and libnet
12+
libraries. It used pure link layer system calls to get
13+
settings and generate ARP PACKETs for sending and handling.
14+
15+
However, everything is not so simple. For portability,
16+
It has been found more efficient that if we use a well
17+
known and portable library, we can solve portability problem.
18+
So, It is decided on to use libpcap and libnet libraries
19+
for sending and handling ARP packets and decide on them
20+
what to do.
21+
22+
As you have already dealt with the program, It has two processess.
23+
One, child enters in a infinite loop for recieving ARP
24+
REPLY packets and then printing IP and MAC Addresses as it
25+
gets packet from the interface. The second process, our parent,
26+
get a number of maximum possible host in the LAN using netmask.
27+
So, then, it starts sending ARP REQUEST packets to the whole
28+
LAN, every ip, not knowing whether the ip address it sends
29+
the ARP REQUEST packet is up or not.
30+
31+
Arter sending packets to whole LAN, it waits an extra 100msecs.
32+
for any late host to answer ARP REQUEST. So, after 100msecs
33+
passed, the send_arp_packet(interface) returns and that process
34+
then sends SIGKILL to the child to inform that there will
35+
be no other machine to reply. So the child quits. The IP and
36+
MAC addresses associated with them are all active machines
37+
on the LAN. Have fun with them!
38+
39+
For installation please READ INSTALL.
40+
41+
42+
43+

TODO

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
-----------------------------------------------------
2+
EnderUnix Knowlan - 0.1
3+
Halil Demirezen <[email protected]
4+
-----------------------------------------------------
5+
6+
7+
TODO for closest terms.
8+
9+
10+
* Portability will be completed for *BSD platforms fully.
11+
12+
* Portability for SUN Solaris platforms
13+
14+
* MAC Address Vendors.
15+
16+
* Hostnames
17+

configure

+183
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
#!/bin/sh
2+
3+
# Let,s chect environment. For instance what we are on
4+
5+
OS=`uname -s`
6+
MAC=`uname -m`
7+
RELEASE=`uname -r`
8+
9+
10+
# Whoarewe ? :)
11+
12+
ME=`whoami`
13+
14+
15+
echo -n "Operating System Type: "
16+
17+
if test "$OS" = Linux; then
18+
echo "Linux"
19+
elif test "$OS" = FreeBSD; then
20+
echo "FreeBSD"
21+
elif test "$OS" = OpenBSD; then
22+
echo "OpenBSD"
23+
elif test "$OS" = NetBSD; then
24+
echo "NetBSD"
25+
fi
26+
27+
28+
29+
echo -n "testing /usr/include/stdio.h..."
30+
if(test -f /usr/include/stdio.h); then
31+
echo "ok"
32+
else
33+
exit
34+
fi
35+
36+
echo -n "testing /usr/include/stdlib.h..."
37+
if(test -f /usr/include/stdlib.h); then
38+
echo "ok"
39+
else
40+
exit
41+
fi
42+
43+
echo -n "testing /usr/include/errno.h..."
44+
if(test -f /usr/include/errno.h); then
45+
echo "ok"
46+
else
47+
echo "no"
48+
fi
49+
50+
if test "$OS" = Linux; then
51+
echo -n "testing /usr/include/pcap.h..."
52+
if(test -f /usr/include/pcap.h); then
53+
echo "ok"
54+
else
55+
exit
56+
fi
57+
fi
58+
59+
60+
echo -n "testing /usr/include/sys/socket.h..."
61+
if(test -f /usr/include/sys/socket.h); then
62+
echo "ok"
63+
else
64+
exit;
65+
fi
66+
67+
68+
echo -n "testing /usr/include/netinet/in.h..."
69+
if(test -f /usr/include/netinet/in.h); then
70+
echo "ok"
71+
else
72+
exit;
73+
fi
74+
75+
76+
echo -n "testing /usr/include/arpa/inet.h..."
77+
if(test -f /usr/include/arpa/inet.h); then
78+
echo "ok"
79+
else
80+
exit
81+
fi
82+
83+
echo -n "testing /usr/include/netinet/if_ether.h..."
84+
if(test -f /usr/include/netinet/if_ether.h); then
85+
echo "ok"
86+
else
87+
exit
88+
fi
89+
90+
if test "$OS" = Linux; then
91+
echo -n "testing /usr/include/libnet.h..."
92+
if(test -f /usr/include/libnet.h); then
93+
echo "ok"
94+
else
95+
exit
96+
fi
97+
elif test "$OS" = FreeBSD || test "$OS" = OpenBSD || test "$OS" = NetBSD; then
98+
echo -n "testing /usr/local/include/libnet.h..."
99+
if(test -f /usr/local/include/libnet.h); then
100+
echo "ok"
101+
else
102+
exit
103+
fi
104+
fi
105+
106+
107+
108+
109+
110+
111+
if test "$OS" = FreeBSD || test "$OS" = OpenBSD || test "$OS" = NetBSD; then
112+
echo -n "testing /usr/local/lib/libnet.a..."
113+
if(test -f /usr/local/lib/libnet.a); then
114+
echo "ok"
115+
else
116+
echo "can't find required libnet.a static library"
117+
exit
118+
fi
119+
fi
120+
121+
if test "$OS" = Linux; then
122+
echo -n "testing /usr/lib/libnet.a..."
123+
if(test -f /usr/lib/libnet.a); then
124+
echo "ok"
125+
else
126+
echo "can't find required libnet.a static library"
127+
exit
128+
fi
129+
130+
fi
131+
132+
133+
if test "$OS" = Linux; then
134+
echo -n "testing /usr/lib/libpcap.a..."
135+
if(test -f /usr/lib/libpcap.a); then
136+
echo "ok"
137+
else
138+
echo "can't find required libpcap.a static library"
139+
exit
140+
fi
141+
fi
142+
143+
144+
145+
146+
147+
echo -n "Writing MakeFile..."
148+
149+
echo "#!/usr/bin/make -f" > Makefile
150+
echo "LIBNETDEFS = `libnet-config --defines`" >> Makefile
151+
echo "LIBNETLIB = `libnet-config --libs`" >> Makefile
152+
echo " " >> Makefile
153+
echo " " >> Makefile
154+
echo "all: kn_arp.c kn_main.c kn_defs.h" >> Makefile
155+
echo " gcc -Wall -c kn_main.c" >> Makefile
156+
157+
if test "$OS" = Linux; then
158+
echo " gcc -Wall \$(LIBNETDEFS) -c kn_arp.c" >> Makefile
159+
echo " gcc -o knowlan kn_main.o kn_arp.o -lnet -lpcap" >> Makefile
160+
echo " " >> Makefile
161+
echo " " >> Makefile
162+
echo "install: knowlan" >> Makefile
163+
echo " /bin/cp knowlan /usr/sbin/knowlan" >> Makefile
164+
echo " /bin/chown root.root /usr/sbin/knowlan" >> Makefile
165+
echo " /bin/chmod 755 /usr/sbin/knowlan" >> Makefile
166+
elif test "$OS" = FreeBSD || test "$OS" = OpenBSD || test "$OS" = NetBSD; then
167+
echo " gcc -Wall -D__BSD__=1 -D__GLIBC__=1 -I/usr/local/include/ \$(LIBNETDEFS) -c kn_arp.c" >> Makefile
168+
echo " gcc -o knowlan kn_main.o kn_arp.o /usr/local/lib/libnet.a -lpcap" >> Makefile
169+
echo " " >> Makefile
170+
echo " " >> Makefile
171+
echo "install: knowlan" >> Makefile
172+
echo " /bin/cp knowlan /usr/sbin/knowlan" >> Makefile
173+
echo " /bin/chown root.root /usr/sbin/knowlan" >> Makefile
174+
echo " /bin/chmod 755 /usr/sbin/knowlan" >> Makefile
175+
fi
176+
177+
echo "clean:" >> Makefile
178+
echo " find ./ -name \"*.o\" -exec rm -rf {} \;" >> Makefile
179+
echo " find ./ -name \"knowlan\" -exec rm -rf {} \;" >> Makefile
180+
echo " find ./ -name \"*core\" -exec rm -rf {} \;" >> Makefile
181+
182+
echo "Done."
183+

0 commit comments

Comments
 (0)