projects
/
rrq
/
newlisp-ftw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
78a5c6f
)
show ip bits
author
root
<root@gitea.devuan.dev>
Wed, 22 Sep 2021 13:26:40 +0000
(13:26 +0000)
committer
root
<root@gitea.devuan.dev>
Wed, 22 Sep 2021 13:26:40 +0000
(13:26 +0000)
socket-sniff.lsp
patch
|
blob
|
history
diff --git
a/socket-sniff.lsp
b/socket-sniff.lsp
index 980abe0bcd76ae478905bb8619ed9a82bb64865f..f056d2e34ca569f7b14123f7c472e6f919b47749 100755
(executable)
--- a/
socket-sniff.lsp
+++ b/
socket-sniff.lsp
@@
-46,6
+46,10
@@
(context MAIN)
(context MAIN)
+(define (ipbits IP)
+ (join (map (fn (X) (-8 (string "0000000" (bits X))))
+ (map int (parse IP ".")))))
+
(setf IFACE (main-args -1) FD (LIBC6:raw-socket) )
(when (< FD)
(setf IFACE (main-args -1) FD (LIBC6:raw-socket) )
(when (< FD)
@@
-71,17
+75,17
@@
(let ((IP (LN 0)) (N (LN 1)))
(TOT IP (+ (or (TOT IP) 0) N))
(TOT IP (max 0 (- (or (TOT IP) 0) 10000)))
(let ((IP (LN 0)) (N (LN 1)))
(TOT IP (+ (or (TOT IP) 0) N))
(TOT IP (max 0 (- (or (TOT IP) 0) 10000)))
- (push (list IP (TOT IP) (TBL IP)) OUT -1)
+ (push (list
(ipbits IP)
IP (TOT IP) (TBL IP)) OUT -1)
(TBL IP 0)))
(sort OUT (fn (x y)
(TBL IP 0)))
(sort OUT (fn (x y)
- (and (> (x
1
))
- (if (> (x
2)) (or (= (y 2)) (> (x 1) (y 1
)))
- (= (y
1
)) true
- (= (y
2)) (> (x 1) (y 1
))))))
+ (and (> (x
-2
))
+ (if (> (x
-1)) (or (= (y -1)) (> (x -2) (y -2
)))
+ (= (y
-2
)) true
+ (= (y
-1)) (> (x -2) (y -2
))))))
(dotimes (i 30)
(! "tput el")
(when (setf x (pop OUT))
(dotimes (i 30)
(! "tput el")
(when (setf x (pop OUT))
- (unless (> (x
1
)) (setf x nil)))
+ (unless (> (x
-2
)) (setf x nil)))
(println (or x "")))))))
(! "clear")
(println (or x "")))))))
(! "clear")