Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - benbenjamin

#1
haha... yes that is exactly what I was trying to do!. Many thanks.
#2
I have written the following code, but I can not work out how to return the line that the match is found in.


(set 'wireshark "http://anonsvn.wireshark.org/wireshark/trunk/manuf")

(set 'arptable (map (fn (x) (parse x " ")) (exec "arp -a")))

(define (cleanIPaddress x)
  (slice x 1 -1))

(define (cleanMACaddress x)
  (upper-case (join (slice (parse x ":") 0 3) ":")))

(define (addIPandMACaddress x)
  (list (cleanIPaddress (nth 1 x)) (cleanMACaddress (nth 3 x))))

(set 'arplist (map addIPandMACaddress arptable))

(set 'routerMAC (last (assoc (exec "ipconfig getoption en1 router") arplist)))

(find-all routerMAC (get-url wireshark))

returns

("20:AA:4B")

so I know that the code "works"



but I would like to retrieve the full line of text


"20:AA:4B Cisco-Li # Cisco-Linksys, LLC"

so I can parse it into


( (exec "ipconfig getoption en1 router") "20:AA:4B" "Cisco-Li" "Cisco-Linksys")