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

add offline mode and fix ports #130

Open
wants to merge 1 commit 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
8 changes: 7 additions & 1 deletion src/main/kotlin/pubg/radar/Game.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ fun gameOver() {
gameListeners.forEach { it.onGameOver() }
}

lateinit var Args: Array<String>
fun main(args: Array<String>) {
Args=args
if (Args.size >= 1) {
println("Loading PCAP File ${Args[0]}")
Sniffer.sniffLocationOffline()
}
Sniffer.sniffLocationOnline()
val ui = GLMap()
ui.show()
}
}
12 changes: 6 additions & 6 deletions src/main/kotlin/pubg/radar/sniffer/Sniffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class Sniffer {
fun sniffLocationOnline() {
val handle = nif.openLive(snapLen, mode, timeout)
val filter = when (sniffOption) {
PortFilter -> "udp portrange 7000-7999"
PortFilter -> "udp portrange 3000-7999"
PPTPFilter -> "ip[9]=47"
}
handle.setFilter(filter, OPTIMIZE)
Expand All @@ -194,9 +194,9 @@ class Sniffer {
val udp = udp_payload(packet) ?: return@loop
val raw = udp.payload.rawData
if (ip.header.srcAddr == localAddr) {
if (udp.header.dstPort.valueAsInt() in 7000..7999)
if (udp.header.dstPort.valueAsInt() in 3000..7999)
proc_raw_packet(raw, false)
} else if (udp.header.srcPort.valueAsInt() in 7000..7999)
} else if (udp.header.srcPort.valueAsInt() in 3000..7999)
proc_raw_packet(raw, true)
} catch (e: Exception) {
}
Expand All @@ -206,7 +206,7 @@ class Sniffer {

fun sniffLocationOffline(): Thread {
return thread(isDaemon = true) {
val files = arrayOf("d:\\new05.pcap")
val files = arrayOf(Args[0])
for (file in files) {
val handle = Pcaps.openOffline(file)

Expand All @@ -217,9 +217,9 @@ class Sniffer {
val udp = udp_payload(packet) ?: continue
val raw = udp.payload.rawData
if (ip.header.srcAddr == localAddr) {
if (udp.header.dstPort.valueAsInt() in 7000..7999)
if (udp.header.dstPort.valueAsInt() in 3000..7999)
proc_raw_packet(raw, false)
} else if (udp.header.srcPort.valueAsInt() in 7000..7999)
} else if (udp.header.srcPort.valueAsInt() in 3000..7999)
proc_raw_packet(raw,true)
} catch (e: Exception) {
}
Expand Down