Skip to content

Instantly share code, notes, and snippets.

@alx
Created November 16, 2010 15:36
Show Gist options
  • Save alx/701943 to your computer and use it in GitHub Desktop.
Save alx/701943 to your computer and use it in GitHub Desktop.
First draft for the USB Gangbang
framework 'AppKit'
class AppDelegate
def applicationDidFinishLaunching(notification)
voice_type = "com.apple.speech.synthesis.voice.Alex"
@voice = NSSpeechSynthesizer.alloc.initWithVoice(voice_type)
end
def windowWillClose(notification)
puts "Bye!"
exit
end
def say_hello(sender)
@voice.startSpeakingString("What the fuck!")
puts "Hello World!"
end
def usbgangbang(sender)
system "/bin/echo 123"
puts "done"
end
end
app = NSApplication.sharedApplication
app.delegate = AppDelegate.new
window = NSWindow.alloc.initWithContentRect([0, 0, 1280, 750],
styleMask:NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask,
backing:NSBackingStoreBuffered,
defer:false)
window.title = 'USB GangBang'
window.level = 3
window.delegate = app.delegate
[NSFont fontWithName:@"Lucida Grande" size:10.0];
button = NSButton.alloc.initWithFrame([10, 10, 1270, 740])
button.bezelStyle = 4
button.title = 'Hello World!'
button.target = app.delegate
button.action = 'usbgangbang:'
window.contentView.addSubview(button)
window.display
window.orderFrontRegardless
app.run
#!/bin/bash
#########################################
# GangBangUsb V0.1
# By Alx Girard & Fedaikin
# For the Tetalab http://www.tetalab.org
#########################################
IFS="
"
# Variables
dest_dir="/Users/alx/Downloads/p2p"
device="/Volumes/STORE\ N\ GO"
device_dest="/GBUSB"
nbr=1
nbr_in=1
# Récupération des fichiers
download_file () {
nbr_in=0
## for file_in in `find $device -type f -name "*.mp3" -exec cp -i {} $dest_dir \;`
for file_in in `find $device -type f -name "*.mp3"`
do
liste_in[$nbr_in]="$file_in"
nbr_in=` expr $nbr_in + 1 `
done
# Random
index=`expr $RANDOM % $nbr_in `
# Upload du fichier sélectionné
cp -i ${liste_in[$index]} $dest_dir
}
# Upload des fichiers
upload_file () {
nbr=0
free_space=`df -k $device | grep $device | awk '{print $4}'`
for file in `find $dest_dir -type f -size -$free_space`
do
liste[$nbr]="$file"
nbr=` expr $nbr + 1 `
done
# Random
index=`expr $RANDOM % $nbr `
# Upload du fichier sélectionné
cp -i ${liste[$index]} $device$device_dest
}
# Debut
download_file
mkdir $device$device_dest
while [ $nbr -gt 0 ]
do
upload_file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment