Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修正多网卡无法正确匹配IP地址bug,多网卡请指定--device #2

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
pkgname='zdcclient'
pkgver='1.6'
pkgrel=1
pkgdesc="Nettool for school in china,Connect x802.1fixed"
url="git+https://github.com/isombyt/zdcclient.git"
arch=('x86_64' 'i386')
license=('GPL')
source=($pkgname::git://github.com/acoret/zdcclient.git)
gitsource=($pkgname::https://github.com/acoret/zdcclient.git)
makedepends=('libcap' 'make' 'git')
depends=('libcap')

md5sums=('SKIP')
build()
{
cd $pkgname
make -j
}
package()
{
echo 'please edit runzdclient...'
cd $pkgname
install -Dm4755 zdclient ${pkgdir}/usr/local/bin/zdclient
install -Dm0755 runzdclient ${pkgdir}/usr/local/bin/runzdclient
}
post_install()
{
echo 'please check if /usr/local/bin/runzdclient contain right user and passwd'
}
2 changes: 2 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ program_running_check()
if ( kill (fl.l_pid, SIGINT) == -1 )
perror("kill");
fprintf (stdout, "&&Info: Kill Signal Sent to PID %d.\n", fl.l_pid);
if (!remove(LOCKFILE))
fprintf(stdout,"&&Info: LOCKFILE delete failed,please remove it: %s",LOCKFILE);
}
else
fprintf (stderr, "&&Info: NO ZDClient Running.\n");
Expand Down
10 changes: 10 additions & 0 deletions zdclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,13 @@ void init_device()
dev = alldevs->name;
strcpy (dev_if_name, dev);
}
else
for(alldevs;alldevs;alldevs=alldevs->next)
if (strcmp(alldevs->name,dev)==0)
{
strcpy (dev_if_name, dev);
break;
}

if (dev == NULL) {
fprintf(stderr, "Couldn't find default device: %s\n",
Expand Down Expand Up @@ -629,6 +636,9 @@ void init_device()
local_mask = ((struct sockaddr_in *)addrs->netmask)->sin_addr.s_addr;
}
}



#ifdef __linux
/* get device basic infomation */
struct ifreq ifr;
Expand Down
8 changes: 3 additions & 5 deletions zdclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#include "md5.h"

/* ZDClient Version */
#define ZDC_VER "0.13"
#define ZDC_VER "0.16"

/* default snap length (maximum bytes per packet to capture) */
#define SNAP_LEN 1518
Expand Down Expand Up @@ -87,7 +87,7 @@ enum EAPType {
EAP_RESPONSE_MD5_CHALLENGE,
EAP_SUCCESS,
EAP_FAILURE,
ERROR,
ERROR,
EAP_REQUEST_MD5_KEEP_ALIVE=250
};

Expand All @@ -111,7 +111,7 @@ void init_info();
void init_device();
void init_arguments(int *argc, char ***argv);
int set_device_new_ip();
void fill_password_md5(uint8_t attach_key[], uint8_t eap_id);
void fill_password_md5(uint8_t attach_key[], uint8_t eap_id);
void fill_uname_md5(uint8_t attach_key[], uint8_t eap_id);
int program_running_check();
void daemon_init(void);
Expand All @@ -124,5 +124,3 @@ int code_convert(char *from_charset, char *to_charset,
void
get_packet(uint8_t *args, const struct pcap_pkthdr *header,
const uint8_t *packet);