mirror of
https://github.com/M66B/NetGuard.git
synced 2025-02-27 00:23:11 +00:00
Native fixed port number logging
This commit is contained in:
parent
15734a8b6e
commit
1d294dba2d
3 changed files with 13 additions and 11 deletions
|
@ -100,7 +100,7 @@ public class LogAdapter extends CursorAdapter {
|
||||||
else
|
else
|
||||||
tvProtocol.setText(protocol < 0 ? "" : Integer.toString(protocol));
|
tvProtocol.setText(protocol < 0 ? "" : Integer.toString(protocol));
|
||||||
|
|
||||||
tvPort.setText(port <= 0 ? "" : Integer.toString(port));
|
tvPort.setText(port < 0 ? "" : Integer.toString(port));
|
||||||
tvFlags.setText(flags);
|
tvFlags.setText(flags);
|
||||||
|
|
||||||
// Application icon
|
// Application icon
|
||||||
|
|
|
@ -600,8 +600,8 @@ void handle_ip(const struct arguments *args, const uint8_t *buffer, const uint16
|
||||||
|
|
||||||
// Get ports & flags
|
// Get ports & flags
|
||||||
int syn = 0;
|
int syn = 0;
|
||||||
uint16_t sport = 0;
|
int32_t sport = -1;
|
||||||
uint16_t dport = 0;
|
int32_t dport = -1;
|
||||||
if (protocol == IPPROTO_TCP) {
|
if (protocol == IPPROTO_TCP) {
|
||||||
struct tcphdr *tcp = payload;
|
struct tcphdr *tcp = payload;
|
||||||
|
|
||||||
|
@ -684,6 +684,7 @@ void handle_ip(const struct arguments *args, const uint8_t *buffer, const uint16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle allowed traffic
|
||||||
if (allowed) {
|
if (allowed) {
|
||||||
if (protocol == IPPROTO_TCP)
|
if (protocol == IPPROTO_TCP)
|
||||||
allowed = handle_tcp(args, buffer, length, uid);
|
allowed = handle_tcp(args, buffer, length, uid);
|
||||||
|
@ -691,6 +692,7 @@ void handle_ip(const struct arguments *args, const uint8_t *buffer, const uint16
|
||||||
allowed = 0;
|
allowed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log traffic
|
||||||
if (args->log) {
|
if (args->log) {
|
||||||
if (!args->filter || syn)
|
if (!args->filter || syn)
|
||||||
log_java(args, version, source, sport, dest, dport, protocol, flags, uid, allowed);
|
log_java(args, version, source, sport, dest, dport, protocol, flags, uid, allowed);
|
||||||
|
@ -1352,10 +1354,10 @@ void log_android(int prio, const char *fmt, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void log_java(
|
void log_java(
|
||||||
const struct arguments *args, uint8_t version,
|
const struct arguments *args, jint version,
|
||||||
const char *source, uint16_t sport,
|
const char *source, jint sport,
|
||||||
const char *dest, uint16_t dport,
|
const char *dest, jint dport,
|
||||||
uint8_t protocol, const char *flags,
|
jint protocol, const char *flags,
|
||||||
jint uid, jboolean allowed) {
|
jint uid, jboolean allowed) {
|
||||||
#ifdef PROFILE
|
#ifdef PROFILE
|
||||||
float mselapsed;
|
float mselapsed;
|
||||||
|
|
|
@ -108,10 +108,10 @@ uint16_t calc_checksum(uint8_t *buffer, uint16_t length);
|
||||||
|
|
||||||
void log_android(int prio, const char *fmt, ...);
|
void log_android(int prio, const char *fmt, ...);
|
||||||
|
|
||||||
void log_java(const struct arguments *args, uint8_t version,
|
void log_java(const struct arguments *args, jint version,
|
||||||
const char *source, uint16_t sport,
|
const char *source, jint sport,
|
||||||
const char *dest, uint16_t dport,
|
const char *dest, jint dport,
|
||||||
uint8_t protocol, const char *flags,
|
jint protocol, const char *flags,
|
||||||
jint uid, jboolean allowed);
|
jint uid, jboolean allowed);
|
||||||
|
|
||||||
void write_pcap(const void *ptr, size_t len);
|
void write_pcap(const void *ptr, size_t len);
|
||||||
|
|
Loading…
Reference in a new issue