Results 1 to 2 of 2

Thread: Kismet gpsmap output

  1. #1
    Just burned his ISO
    Join Date
    Jul 2008
    Posts
    2

    Default Kismet gpsmap output

    I've been experimenting with backtrack for a while now, I recently got GPS working and after finding parknation.com/gmap/index.php I've got the data collected from kismet on a google map.

    *EDIT* I've managed to qet quite a lot of what i had asked working, my code so far is
    Code:
    #!/bin/bash
    # Separates Sections of File
    for file in *.js; do
    awk '/^var NetCircles = {/,/^var NetPoints = {/' $file > $file.NetCircles.txt
    awk '/^var NetPoints = {/,/^var Networks = {/' $file > $file.NetPoints.txt
    awk '/^var Networks = {/,/^};/' $file > $file.Networks.txt
    
    # Removes Unwanted Text
    sed -i '/var NetCircles = {/ d' $file.NetCircles.txt
    sed -i '/};/ d' $file.NetCircles.txt
    sed -i '/var NetPoints = {/ d' $file.NetCircles.txt
    sed -i '/var NetPoints = {/ d' $file.NetPoints.txt
    sed -i '/};/ d' $file.NetPoints.txt
    sed -i '/var Networks = {/ d' $file.NetPoints.txt
    sed -i '/var Networks = {/ d' $file.Networks.txt
    sed -i '$s/..$//' $file.Networks.txt
    
    # Removes Blank Lines
    sed -i '/^$/d' $file.NetCircles.txt
    sed -i '/^$/d' $file.NetPoints.txt
    sed -i '/^$/d' $file.Networks.txt
    
    done
    
    # Cat separate files
    sed -i "s/$/,/g" *.NetCircles.txt
    cat *.NetCircles.txt > NetCircles.txt
    sed -i '$s/.$//' NetCircles.txt
    cat *.NetPoints.txt > NetPoints.txt
    sed -i 's/]/]\
    ,/' NetPoints.txt
    sed -i '$s/.$//' NetPoints.txt
    # might need to add , to last line
    cat *.Networks.txt > Networks.txt
    
    # Adds Required Text
    sed -i '1i\var NetCircles = {' NetCircles.txt
    sed -i '$a\};' NetCircles.txt
    sed -i '1i\var NetPoints = {' NetPoints.txt
    sed -i '$a\};' NetPoints.txt
    sed -i '1i\var Networks = {' Networks.txt
    sed -i '$a\};' Networks.txt
    
    # Combines Files into gpsdata.js for use with google Maps
    cat NetCircles.txt NetPoints.txt Networks.txt > newgpsdata.js
    
    # Adds start location for map
    sed -i '1i\var NetworkCenter = [50.431581,-4.942217];' newgpsdata.js
    
    # Delete working files
    rm *.txt
    All that remains is to search Networks.txt for any line that starts with "'channel':" and add a "," to the end of the line. But i haven't managed to work that out yet.

  2. #2
    Just burned his ISO
    Join Date
    Jul 2008
    Posts
    2

    Default

    After a lot of trial and error I managed to get it working to what i feel is a reasonable standard. The following bash script will combine all files ending .js it finds in the directory into one file called newgpsdata.js

    I've tested it and it all works, the only improvement I've thought of (but cant code) is if a network is in more than one .js file it will occur more than once in the final file. it doesn't cause any problems as the markers are just placed over each other, but its obviously not ideal.

    Code:
    #!/bin/bash
    # Separates Sections of File
    for file in *.js; do
    	awk '/^var NetCircles = {/,/^var NetPoints = {/' $file > $file.NetCircles.txt
    	awk '/^var NetPoints = {/,/^var Networks = {/' $file > $file.NetPoints.txt
    	awk '/^var Networks = {/,/^};/' $file > $file.Networks.txt
    
    	# Removes Unwanted Text
    	sed -i '/var NetCircles = {/ d' $file.NetCircles.txt
    	sed -i '/};/ d' $file.NetCircles.txt
    	sed -i '/var NetPoints = {/ d' $file.NetCircles.txt
    	sed -i '/var NetPoints = {/ d' $file.NetPoints.txt
    	sed -i '/};/ d' $file.NetPoints.txt
    	sed -i '/var Networks = {/ d' $file.NetPoints.txt
    	sed -i '/var Networks = {/ d' $file.Networks.txt
    	sed -i '$s/..$//' $file.Networks.txt
    
    	# Removes Blank Lines
    	sed -i '/^$/d' $file.NetCircles.txt
    	sed -i '/^$/d' $file.NetPoints.txt
    	sed -i '/^$/d' $file.Networks.txt
    
    done
    
    # Cat separate files
    sed -i '$s/$/&,/' *.NetCircles.txt
    cat *.NetCircles.txt > NetCircles.txt
    sed -i '$s/.$//' NetCircles.txt
    sed -i '$a\,' *.NetPoints.txt
    cat *.NetPoints.txt > NetPoints.txt
    sed -i '$s/.$//' NetPoints.txt
    sed -i '$s/$/&,/' *.Networks.txt
    cat *.Networks.txt > Networks.txt
    sed -i '$s/.$//' Networks.txt
    
    # Removes Blank Lines
    sed -i '/^$/d' NetCircles.txt
    sed -i '/^$/d' NetPoints.txt
    sed -i '/^$/d' Networks.txt
    
    # Adds Required Text
    sed -i '1i\var NetCircles = {' NetCircles.txt
    sed -i '$a\};' NetCircles.txt
    sed -i '1i\var NetPoints = {' NetPoints.txt
    sed -i '$a\};' NetPoints.txt
    sed -i '1i\var Networks = {' Networks.txt
    sed -i '$a\};' Networks.txt
    
    # Combines Files into gpsdata.js for use with google Maps
    cat NetCircles.txt NetPoints.txt Networks.txt > newgpsdata.js
    
    # Adds start location for map
    ## Change to the Lat, Lon you want
    sed -i '1i\var NetworkCenter = [XX,XX];' newgpsdata.js
    
    # Delete working files
    rm *.txt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •