add(root): new package zmap
This commit is contained in:
parent
0f21729b82
commit
6b294d985c
|
@ -0,0 +1,11 @@
|
|||
TERMUX_PKG_HOMEPAGE=https://zmap.io/
|
||||
TERMUX_PKG_DESCRIPTION="A fast single packet network scanner designed for Internet-wide network surveys"
|
||||
TERMUX_PKG_LICENSE="Apache-2.0"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION="3.0.0-beta1"
|
||||
TERMUX_PKG_SRCURL=https://github.com/zmap/zmap/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
|
||||
TERMUX_PKG_SHA256=c97c452930ad6af95ad9ad79e66fea742f904b8e102c185f1001822cc5b5ceb3
|
||||
TERMUX_PKG_BUILD_DEPENDS="json-c, libgmp, gengetopt, libpcap, libunistring"
|
||||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
|
||||
-DRESPECT_INSTALL_PREFIX_CONFIG=ON
|
||||
"
|
|
@ -0,0 +1,35 @@
|
|||
diff --git a/conf/zmap.conf b/conf/zmap.conf
|
||||
index 817c184..b390da7 100644
|
||||
--- a/conf/zmap.conf
|
||||
+++ b/conf/zmap.conf
|
||||
@@ -16,7 +16,7 @@
|
||||
### RFC1918, IANA reserved, and multicast networks,
|
||||
### in addition to those who have opted out of your
|
||||
### network scans.
|
||||
-blocklist-file "/etc/zmap/blocklist.conf"
|
||||
+blocklist-file "@TERMUX_PERFIX@/etc/zmap/blocklist.conf"
|
||||
|
||||
### Optionally print a summary at the end
|
||||
#summary
|
||||
diff --git a/src/zmap.c b/src/zmap.c
|
||||
index 77674e0..0ed66cc 100644
|
||||
--- a/src/zmap.c
|
||||
+++ b/src/zmap.c
|
||||
@@ -650,14 +650,14 @@ int main(int argc, char *argv[])
|
||||
zconf.destination_cidrs = args.inputs;
|
||||
zconf.destination_cidrs_len = args.inputs_num;
|
||||
if (zconf.destination_cidrs && zconf.blocklist_filename &&
|
||||
- !strcmp(zconf.blocklist_filename, "/etc/zmap/blocklist.conf")) {
|
||||
+ !strcmp(zconf.blocklist_filename, "@TERMUX_PREFIX@/etc/zmap/blocklist.conf")) {
|
||||
log_warn(
|
||||
"blocklist",
|
||||
"ZMap is currently using the default blocklist located "
|
||||
- "at /etc/zmap/blocklist.conf. By default, this blocklist excludes locally "
|
||||
+ "at @TERMUX_PREFIX@/etc/zmap/blocklist.conf. By default, this blocklist excludes locally "
|
||||
"scoped networks (e.g. 10.0.0.0/8, 127.0.0.1/8, and 192.168.0.0/16). If you are"
|
||||
" trying to scan local networks, you can change the default blocklist by "
|
||||
- "editing the default ZMap configuration at /etc/zmap/zmap.conf.");
|
||||
+ "editing the default ZMap configuration at @TERMUX_PREFIX@/etc/zmap/zmap.conf.");
|
||||
}
|
||||
SET_IF_GIVEN(zconf.allowlist_filename, allowlist_file);
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/src/src/CMakeLists.txt b/src/src/CMakeLists.txt
|
||||
index e11c555..599ebb8 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -187,7 +187,7 @@ add_custom_command(OUTPUT parser.c
|
||||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT parser.c
|
||||
- COMMAND byacc -d -o "${CMAKE_CURRENT_BINARY_DIR}/parser.c" "${CMAKE_CURRENT_SOURCE_DIR}/parser.y"
|
||||
+ COMMAND yacc -d -o "${CMAKE_CURRENT_BINARY_DIR}/parser.c" "${CMAKE_CURRENT_SOURCE_DIR}/parser.y"
|
||||
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/parser.y"
|
||||
)
|
||||
endif()
|
|
@ -0,0 +1,18 @@
|
|||
diff --git a/lib/util.c b/lib/util.c
|
||||
index 0a1403f..1209201 100644
|
||||
--- a/lib/util.c
|
||||
+++ b/lib/util.c
|
||||
@@ -333,8 +333,13 @@ int set_cpu(uint32_t core)
|
||||
CPU_ZERO(&cpuset);
|
||||
CPU_SET(core, &cpuset);
|
||||
|
||||
+#if defined(__ANDROID__) //
|
||||
+ if (sched_setaffinity(pthread_gettid_np(pthread_self()),
|
||||
+ sizeof(cpu_set_t), &cpuset) == -1) {
|
||||
+#else
|
||||
if (pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t),
|
||||
&cpuset) != 0) {
|
||||
+#endif
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
Loading…
Reference in New Issue