Active Topics

 



Notices


Reply
Thread Tools
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#1
Driftnet, for those not knowing already, is a specialized packet sniffer. It looks for images being transferred (jpeg or gif, optionally mpeg audio too, but no png ) and either
  1. displays them with a gtk1 window
    --or--
  2. saves them to a directory for some other process (e.g. jwz's webcollage) to handle
Since (AFAIK) ITs are gtk2 only, adjunct mode (b) is the way to go, as the binary may be compiled with no gtk support for that purpose.
Quiver works great for handling the output... See the picture where it shows some itT forum avatars. And as new images are snagged, Quiver automatically adds them at the bottom of the film-strip, so no need to refresh or anything.

Enjoy!

To get it running:
  1. install driftnet to /usr/bin (or elsewhere, but then change the script to match)
  2. install drift.sh to anyplace convenient.
  3. mkdir /home/user/.images/driftnet (or elsewhere, as above)
  4. visudo this:
    Code:
    user ALL = NOPASSWD: /usr/bin/driftnet
  5. drift.sh

p.s. Just had a brilliant idea to exclude "small" images -- if you have imagemagick installed. That's coming up in a few, and I'm open to any suggestions of other apps that can grab image size. (And don't take up 23 MB)
Attached Images
 
Attached Files
File Type: zip driftnet.zip (26.6 KB, 353 views)
 

The Following User Says Thank You to Benson For This Useful Post:
Bundyo's Avatar
Posts: 4,708 | Thanked: 4,649 times | Joined on Oct 2007 @ Bulgaria
#2
ls can grab image size any size...
 
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#3
Actually, that's not a bad option; I wonder if different thresholds for jpeg and gif make sense... Nah, anyone who wants that makes their own script
 
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#4
OK, here's the updated drift.sh:
Code:
#!/bin/sh
quiver /home/user/MyDocs/.images/driftnet/&
sudo /usr/bin/driftnet -i wlan0 -a -d /home/user/MyDocs/.images/driftnet | imagetosser.sh
And the new imagetosser.sh:
Code:
#!/bin/sh
minpix=300
minsize=1024
if [ "x`which identify`" != x ] ; then
  echo `which identify` found!
  echo Tossing images less than $minpix pixels.
  while true ; do
    read img
    size=$( expr `identify -format '%w' "$img"` \* `identify -format '%h' "$img"` )
    echo $size
    if [ $size -lt $minpix ] ; then
      echo removing...
      rm "$img"
    fi
  done
else
  echo identify not found! using ls
  echo Tossing images less than $minsize bytes.
  echo
  while true ; do
    read img
    size=$( ls -l "$img" | awk '{print $5}' )
    echo $size
    if [ $size -lt $minsize ] ; then
      echo removing...
      rm "$img"
    fi
  done
fi

Last edited by Benson; 2008-03-26 at 00:54. Reason: Fixed broken pastage
 
Posts: 46 | Thanked: 15 times | Joined on Feb 2007
#5
Is the imagetosser supposed to spit out an endless stream of errors like this:

sh: 1024: unknown operand
ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory

etc?
 
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#6
ummm... no. Looks like I broke it copying and pasting. I'll have that fixed shortly, but I don't think it's your problem.

It looks like you might not have a network connection; it doesn't handle that gracefully.

Why don't you post the entire output?
 
Posts: 46 | Thanked: 15 times | Joined on Feb 2007
#7
( I put both scripts in /usr/local/bin, and modified drift.sh to reflect that).

Nokia-N810-51-3:/usr/local/bin# ./drift.sh
identify not found! using ls
Tossing images less than 1024 bytes.

ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory

sh: 1024: unknown operand
ls: : No such file or directory
Supported file types:
image/x-cmu-raster,image/x-sun-raster,image/x-icon,image/x-ico,image/x-xpixmap,image/x-pcx,image/bmp,image/x-bmp,image/x-MS-bmp,image/jpeg,image/x-tga,image/x-xbitmap,application/x-navi-animation,image/tiff,image/png,image/vnd.wap.wbmp,image/x-portable-anymap,image/x-portable-bitmap,image/x-portable-graymap,image/x-portable-pixmap,image/gif,image/svg,image/svg+xml,
 
mudhoney's Avatar
Posts: 31 | Thanked: 1 time | Joined on Jan 2008
#8
Can we put the n800 wireless hardware into promiscuous mode?
 
Benson's Avatar
Posts: 4,930 | Thanked: 2,272 times | Joined on Oct 2007
#9
Hmmm... can't see why...

Oh, just had an idea. My images directory is actually on the SD, so it doesn't affect me, but driftnet is running as root, and I'll bet it's a permissions issue. So you need to run the entire drift.sh as root, in lieu of a better solution. See if that works.
 
Posts: 46 | Thanked: 15 times | Joined on Feb 2007
#10
I am running it as root.
 
Reply


 
Forum Jump


All times are GMT. The time now is 05:38.