mirror of
https://github.com/void-linux/void-packages.git
synced 2025-07-26 23:42:57 +02:00
New package: pwnat-0.3
This commit is contained in:
parent
116bebc0e7
commit
e3adcb0bfd
2 changed files with 107 additions and 0 deletions
89
srcpkgs/pwnat/patches/fix_argument_parsing.diff
Normal file
89
srcpkgs/pwnat/patches/fix_argument_parsing.diff
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
From ef844e18aad75929bad415bbc633a760890501e8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: timdiels <timdiels.m@gmail.com>
|
||||||
|
Date: Mon, 30 Sep 2013 18:27:13 +0200
|
||||||
|
Subject: [PATCH] Fixed bug in client argument parsing
|
||||||
|
|
||||||
|
e.g. pwnat -c 44444 a b 22
|
||||||
|
would recognise "b" as proxy port, and eventually crash with a segfault
|
||||||
|
---
|
||||||
|
udpclient.c | 45 ++++++++++++++++++++++++++++-----------------
|
||||||
|
1 file changed, 28 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git udpclient.c udpclient.c
|
||||||
|
index a95ac50..0d23c0d 100644
|
||||||
|
--- udpclient.c
|
||||||
|
+++ udpclient.c
|
||||||
|
@@ -60,7 +60,20 @@ static void disconnect_and_remove_client(uint16_t id, list_t *clients,
|
||||||
|
fd_set *fds);
|
||||||
|
static void signal_handler(int sig);
|
||||||
|
|
||||||
|
-int udpclient(int argc, char *argv[])
|
||||||
|
+bool isnumber(const char* str) {
|
||||||
|
+ if (!str) {
|
||||||
|
+ return false;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ char* end;
|
||||||
|
+ strtol(str, &end, 10);
|
||||||
|
+ return *end == '\0';
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * argv: [local ip] <local port> <proxy host> [proxy port] <remote host> <remote port>
|
||||||
|
+ */
|
||||||
|
+int udpclient(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
char *lhost, *lport, *phost, *pport, *rhost, *rport;
|
||||||
|
list_t *clients;
|
||||||
|
@@ -72,7 +85,7 @@ int udpclient(int argc, char *argv[])
|
||||||
|
socket_t *udp_sock = NULL;
|
||||||
|
char data[MSG_MAX_LEN];
|
||||||
|
char addrstr[ADDRSTRLEN];
|
||||||
|
- char pport_s[6];
|
||||||
|
+ char pport_s[6] = "2222";
|
||||||
|
|
||||||
|
struct timeval curr_time;
|
||||||
|
struct timeval check_time;
|
||||||
|
@@ -89,29 +102,27 @@ int udpclient(int argc, char *argv[])
|
||||||
|
int ret;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
- int icmp_sock = 0;
|
||||||
|
+ int icmp_sock = 0;
|
||||||
|
int timeexc = 0;
|
||||||
|
|
||||||
|
- struct sockaddr_in src, dest, rsrc;
|
||||||
|
- struct hostent *hp;
|
||||||
|
- uint32_t timeexc_ip;
|
||||||
|
+ struct sockaddr_in src, dest, rsrc;
|
||||||
|
+ struct hostent *hp;
|
||||||
|
+ uint32_t timeexc_ip;
|
||||||
|
|
||||||
|
signal(SIGINT, &signal_handler);
|
||||||
|
|
||||||
|
+ // Parse arguments
|
||||||
|
i = 0;
|
||||||
|
- if (index(argv[i], 58) || index(argv[i], 46))
|
||||||
|
- lhost = argv[i++];
|
||||||
|
- else
|
||||||
|
- lhost = NULL;
|
||||||
|
+ if (!isnumber(argv[i]))
|
||||||
|
+ lhost = argv[i++];
|
||||||
|
+ else
|
||||||
|
+ lhost = NULL;
|
||||||
|
lport = argv[i++];
|
||||||
|
phost = argv[i++];
|
||||||
|
- if (index(argv[i], 58) || index(argv[i], 46))
|
||||||
|
- {
|
||||||
|
- snprintf(pport_s, 5, "2222");
|
||||||
|
- pport = pport_s;
|
||||||
|
- }
|
||||||
|
- else
|
||||||
|
- pport = argv[i++];
|
||||||
|
+ if (isnumber(argv[i]))
|
||||||
|
+ pport = argv[i++];
|
||||||
|
+ else
|
||||||
|
+ pport = pport_s;
|
||||||
|
rhost = argv[i++];
|
||||||
|
rport = argv[i++];
|
||||||
|
|
18
srcpkgs/pwnat/template
Normal file
18
srcpkgs/pwnat/template
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Template file for 'pwnat'
|
||||||
|
pkgname=pwnat
|
||||||
|
version=0.3
|
||||||
|
# the git-hash of v0.3 as it isn't tagged
|
||||||
|
_githash=572fcfb76a1b4b46faaa6b36817a39671b6f3c7e
|
||||||
|
revision=1
|
||||||
|
homepage="http://samy.pl/pwnat/"
|
||||||
|
distfiles="https://github.com/samyk/pwnat/archive/${_githash}.tar.gz"
|
||||||
|
short_desc="serverless NAT to NAT hole punching"
|
||||||
|
maintainer="Enno Boland <eb@s01.de>"
|
||||||
|
license="GPLv3"
|
||||||
|
checksum=365da981ba1a39d7e3c8427fbcd9e7fcd3dd16cd30ae7e3b0aca50511fd8e1b1
|
||||||
|
wrksrc="${pkgname}-${_githash}"
|
||||||
|
build_style=gnu-makefile
|
||||||
|
|
||||||
|
do_install() {
|
||||||
|
vbin pwnat
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue