Howto:Recover and Undelete files in Ubuntu the easy way!
Ok I accidentally deleted my /etc/network/interfaces file and didnt have my access point connected to a pc, its just wireless now, so what I did to recover the file was this, please note if you delete the file shutdown your pc immediately or unmount your drive as fast as possible to avoid overwriting the deleted data. This method can be used to find unencrypted passwords and interesting information as well. This works best from a livecd/unmounted filesystem:grep --binary-files=text -300 "Unique String in Text file" /dev/hda1 > output.txt
The -300 option tells grep to report the 300 lines before the string you choose
Basically this will take quite a while depending on the size of your hard drive and may output a ton of irrelevent information to the output.txt file, you may want to edit the -300 line variable and do man grep to see further usage options.
This method worked for me only because I shutdown my pc immediately and booted into my Hardy Livecd and the file was still available, I just copied/pasted the relevant output to my interfaces file.
[update]
Alternatively you can use the strings command to dump all the text on a partition then grep the strings output for the relevent output, Here is an example:strings /dev/hda1 > bigtxtfilegrep -i "information" bigtxtfile >grepoutputfile
[update 2]
I ran into another program that is utterly Amazing, actually quite scary, I was able to recover photo's deleted from months ago, even after reading/writing the drive. So now I will need to find a tool to wipe what was deleted lol.. Here is some info..
Foremost is a console program to recover files based on their headers, footers, and internal data structures. This process is commonly referred to as data carving. Foremost can work on image files, such as those generated by dd, Safeback, Encase, etc, or directly on a drive. The headers and footers can be specified by a configuration file or you can use command line switches to specify built-in file types. These built-in types look at the data structures of a given file format allowing for a more reliable and faster recovery.
Originally developed by the United States Air Force Office of Special Investigations and The Center for Information Systems Security Studies and Research , foremost has been opened to the general public
source code http://foremost.sourceforge.net/
Grab foremost:sudo apt-get install foremost
Have Foremost audit your drive for recoverable files:sudo foremost -w -i /dev/hda -o /recovery/foremost
Have foremost recover jpg files:sudo foremost -t jpg -i /dev/hda -o /recovery/foremost
Here is the complete list of recoverable filetypes for usage with the "-t type" switch:
Available types:
jpg Support for the JFIF and Exif formats including implementations
gif
png
bmp Support for windows bmp format.
avi
exe Support for Windows PE binaries, will extract DLL and EXE files
along with their compile times.
mpg Support for most MPEG files (must begin with 0x000001BA)
wav
riff This will extract AVI and RIFF since they use the same file for‐
mat (RIFF). note faster than running each separately.
wmv Note may also extract -wma files as they have similar format. mov
ole This will grab any file using the OLE file structure. This includes PowerPoint, Word, Excel, Access, and StarWriter
doc Note it is more efficient to run OLE as you get more bang for your buck. If you wish to ignore all other ole files then use this.
zip Note is will extract .jar files as well because they use a simi‐
lar format. Open Office docs are just zip’d XML files so they are extracted as well. These include SXW, SXC, SXI, and SX? for undetermined OpenOffice files.
rar
htm
cpp C source code detection, note this is primitive and may generate documents other than C code.
all Run all pre-defined extraction methods. [Default if no -t is specified]
If you have additional suggestions or methods to restore files please comment and share your knowledge
Howto Twitter From the Command Line in Ubuntu!

Twitter rocks, here is a quick n easy way to twitter from your console in any Unix system:sudo apt-get install curlsudo gedit /usr/bin/twitter
Now Paste this in gEdit and simply replace "yourusername" with your username and "yourpasswd" with your twitter passwd and ctrl-s to save, then alt-F4 to exit!curl --basic --user "yourusername:yourpasswd" --data-ascii "status=`echo $@|tr ' ' '+'`" "http://twitter.com/statuses/update.json" -o /dev/null
echo Message Sent!
Then chmod for exec privileges:chmod +x /usr/bin/twitter
All done! w00t! Now lets try it out :)
All you gotta do is:twitter "message here without the quotes"
You dont even need to open the command line, all you gotta do is press alt-F2 and type twitter then your message, and dont forget to check "Run in Terminal"
Howto: Install Safari on Ubuntu with Flash and Shockwave! (Hulu, Youtube, Shockwave Works!)

Ok ive been browser hunting and seen a lot of hype about Safari browser's speed so I decided to give it a whirl, I managed to get it install with Flash and it works very well with youtube and hulu ! Here is how I got it installed, let me know how it goes if you decide to check it out!
By the way im impressed with the speed, its as fast as firefox, if not faster! (unforunately its not open-source :(
First lets install Microshit's Core Fonts and wine within the Terminal Applications->Accessories->Terminalsudo apt-get install msttcorefonts wine
Second Make sure wine is set to use the windows version Xp, just click Applications/Wine/Configure Wine
or type "winecfg" in the terminal
Third lets copy Microshits Core Fonts to the wine font directory!cp /usr/share/fonts/truetype/msttcorefonts/Arial*.ttf ~/.wine/drive_c/windows/fonts/cp /usr/share/fonts/truetype/msttcorefonts/Times_New_Roman*.ttf ~/.wine/drive_c/windows/fonts/
Make sure wine is set to use the windows version Xp, just click Applications/Wine/Configure Wine
or type "winecfg" in the terminal
Lets download my backup of Safari or download herewget http://ubuntu-debs.googlecode.com/files/SafariSetup.exewine SafariSetup.exe
Uncheck ”Install Bonjour for Windows” and “Automatically update Safari and other Apple Software.” after accepting the terms then click install!
Ok now that Safari is Sucessfully installed in Ubuntu lets install flash for safari!wget http://ubuntu-debs.googlecode.com/files/install_flash_player.exewine install_flash_player.exe
Now Safari is Installed with the correct fonts and has flash, so lets execute Safari From Applications->Wine->Programs->Safari
Install Shockwave:
You gotta download and install shockwave slim or full from the adobe site http://www.adobe.com/shockwave/download/alternates/ then:
You need to copy the files located in the adobe shockwave dir to the Safari plugin dir
ie:
cp -R ~/.wine/drive_c/windows/system32/Adobe/Director/* ~/.wine/drive_c/"Program Files"/Safari/Plugins
Then Check Safari's Installed Plug-ins under the Help menu to see which plug-ins Safari is able to find, it should be there!
The new Face to VLC Media Player 0.9.0git!

VLC to me is the best player for Movies, Videos, DVD's, and DiVX! Well its time for everyone to upgrade vlc because there is Multiple vulnerabilities found allowing for the execution of arbitrary code and Denial of Service. But ya know? Im glade I had to upgrade lol, vlc added a whole new face a ton of bug fixes and a few new features :) I'll show you how to install VLC in Ubuntu and setup the Nightly build VideoLan VLC Repository, check it out:
How to Install or upgrade VLC Media Player for Ubuntu Hardy
For Ubuntu Hardy I386 add the following line to your sources.list, or add it to System->Administration->Software Sources:deb http://nightlies.videolan.org/build/hardy-i386/arch ./
Then open up Synaptic and click "Reload", if you already have vlc installed click "Mark all Upgrades" Then click apply then ok. Or simply search for VLC if its not installed, check it and apply.
Want it to install it even easier? Click Here for a 1 click install within Firefox!
The 1-Click install only works after you have updated your repositories and you must use firefox
Howto: Setup Anonymous SSH Via Tor Hidden Services
Ok this is my favorite feature of tor, I have a Completely Anonymous ssh server setup for myself to access from anywhere but I prefer not have people from outside my network access the ssh server. So, only people with my exact *.onion address can access my computer which is only me!
Lets get started!
The first thing I do is setup Vidalia GUI and TOR, there is more information here
Now once you got vidalia and tor setup and running follow these steps:
Next edit ~/.vidalia/torrc and add these two lines:gedit ~/.vidalia/torrcHiddenServiceDir /home/YOURUSERNAME/.vidalia/ssh
HiddenServicePort 22 127.0.0.1:22
The HiddenServiceDir contains a text file that we will cat after we execute tor for our anonsecrethostname.onion
Port 22 is of course SSH
Grab connect.c and lets configure it:wget http://ubuntu-debs.googlecode.com/files/connect.cgcc connect.c -o /etc/ssh/connectsudo gedit /etc/ssh/ssh_config
Append this to /etc/ssh/ssh_config
# use /etc/ssh/connect to use tor to connect to ssh in torland
Host *.onion
ProxyCommand /etc/ssh/connect -S localhost:9050 %h %p
You can append -d for verbose after /etc/ssh/connect if you have problems...
Grab your secret host name:cat ~/.vidalia/ssh/hostname
Right Click Vidalia, Stop Tor and Restart it and your done!
Were done! Now you can do a "ssh user@16xdigit.onion" every time your local tor-server is running.
Enjoy,
defcon
Here is the verbose output when connecting:
ssh dude@ka93kasd55srt56.onion -p 22
DEBUG: No direct address are specified.
DEBUG: relay_method = SOCKS (2)
DEBUG: relay_host=localhost
DEBUG: relay_port=9050
DEBUG: relay_user=dude
DEBUG: socks_version=5
DEBUG: socks_resolve=REMOTE (2)
DEBUG: local_type=stdio
DEBUG: dest_host=ka93kasd55srt56.onion
DEBUG: dest_port=22
DEBUG: Program is $Revision$
DEBUG: checking ka93kasd55srt56.onion is for direct?
DEBUG: ka93kasd55srt56.onion is for not direct.
DEBUG: resolving host by name: localhost
DEBUG: resolved: localhost (127.0.0.1)
DEBUG: connecting to 127.0.0.1:9050
DEBUG: begin_socks_relay()
DEBUG: available auth method[0] = NO-AUTH (0x00)
DEBUG: available auth method[1] = USERPASS (0x02)
DEBUG: atomic_out() [4 bytes]
DEBUG: >>> 05 02 00 02
DEBUG: atomic_in() [2 bytes]
DEBUG: <<< 05 00
DEBUG: auth method: NO-AUTH
DEBUG: atomic_out() [29 bytes]
DEBUG: >>> 02 01 00 03 16 32 74 36 12 6a 65 77 ab 35 35 35 32 7e 6f 76 74 2r 7a 6e 69 6f 9e 08 ae
DEBUG: atomic_in() [4 bytes]
DEBUG: <<< 05 00 00 01
DEBUG: atomic_in() [6 bytes]
DEBUG: <<< 00 00 00 00 00 00
DEBUG: connected
DEBUG: start relaying.
DEBUG: recv 38 bytes
DEBUG: sent 38 bytes
DEBUG: sent 792 bytes
DEBUG: recv 498 bytes
DEBUG: recv 286 bytes
DEBUG: sent 24 bytes
DEBUG: recv 152 bytes
DEBUG: sent 144 bytes
DEBUG: recv 498 bytes
DEBUG: recv 222 bytes
The authenticity of host '[ka93kasd55srt56.onion]:22 (
RSA key fingerprint is a5:f5:a1:6a:re:be:55:t1:4b:b8:y2:e3:aa:09:0f:b0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ka93kasd55srt56.onion]:22' (RSA) to the list of known hosts.
DEBUG: sent 64 bytes
DEBUG: recv 48 bytes
DEBUG: sent 64 bytes
DEBUG: recv 64 bytes
dude@ka93kasd55srt56.onion's password:
Howto: Chat anonymously over the Tor Network with Torchat and Ubuntu!
This howto is for Gutsy or Hardy Heron. It shows you how to configure the onion router tor, and install the P2P client torchat. this client is written in python and runs on windows & MAC too!
TorChat is a peer to peer instant messenger with a completely decentralized design, built on top of Tor's location hidden services, giving you extremely strong anonymity while being very easy to use without the need to install or configure anything.
Tor location hidden services basically means:
- Nobody will be able to find out where you are.
- If they are already observing you and sniff your internet connection they will not be able to find out
1. Install Tor & Privoxy
sudo apt-get install tor privoxy2. Configure Privoxy
sudo gedit /etc/privoxy/configadd this line at the end: (with the dot at the end)
forward-socks4a / localhost:9050 .Restart Privoxy:
sudo /etc/init.d/privoxy restartNow go to Firefox addons and install this neat SwitchProxy Tool. After a FireFox restart, go to Extra > Switch Proxy > manage proxies > add > standard > next.
Enter the following information into both the HTTP Proxy and SSL Proxy fields.
Hostname: 127.0.0.1 Port: 8118.
Use SocksV5 and port 9050 for socks
Set up any proxy exceptions you may need (localhost, 127.0.0.1 is a good idea) and then click on OK.(Do this also for the proxy label)
3. Configure Tor:
sudo gedit /etc/tor/torrcFind the following section and change it to:
############### This section is just for location-hidden services ###
## Once you have configured a hidden service, you can look at the
## contents of the file ".../hidden_service/hostname" for the address
## to tell people.
##
## HiddenServicePort x y:z says to redirect requests on port x to the
## address y:z.
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 11009 127.0.0.1:11009
#HiddenServiceDir /var/lib/tor/other_hidden_service/
#HiddenServicePort 80 127.0.0.1:80
#HiddenServicePort 22 127.0.0.1:22
Now lets create the hidden tor dir & restart tor:
sudo mkdir /var/lib/tor/hidden_service/sudo /etc/init.d/tor restart4. Install Torchat
Now you can use firefox with tor. But we want chat, so get the latest Torchat source (at the time of writing this howto it was version 0.9.9.64)
mkdir ~/torchatwget http://torchat.googlecode.com/files/torchat-source-0.9.9.64.zipunzip torchat-source-0.9.9.64.zipmove source code:
(assuming the py files are unpacked in the folder /home/username/src)
sudo mv src/* ~/torchat/Install needed python-wx:
sudo apt-get install python-wxgtk2.8 python2.5Create starter menu entry:
sudo gedit /usr/share/applications/torchat.desktoppaste into the editor window:
[Desktop Entry]
Encoding=UTF-8
Name=torchat
Comment=anonymous chat client
Exec=python /usr/share/torchat/torchat.py
Icon=/usr/share/torchat/icons/torchat.ico
Terminal=0
Type=Application
Categories=Application;Internet;
5. get your user ID for torchat:
sudo less /var/lib/tor/hidden_service/hostnameThis will display something like:
hanZcp5y3fljsnay.onionThe red part is your id, tell this ID (without the .onion) to your friends to add you to their torchat.
6. Tell Torchat your User ID:
sudo gedit ~/torchat/tc_client.pyChange OWN_HOSTNAME to your userid, or it will NOT work!
OWN_HOSTNAME = "hanZcp5y3fljsnay" #.onion ( <-- change the 16 Quoted chars with your onion ID... the red one from step 5)7. Run Torchat:
Now start torchat with the Start menu Icon or from a terminal:
python ~/torchat/torchat.pyYou will see a window with your contact list. One of the contacts is labled "myself". This 16 numbers and letters are your unique address inside the Tor-Network. Wait a few minutes until the icon becomes green. Give this address to your friends so that they can add you to their list or add your friends address to your list. It all basically behaves like you would expect from an instant messenger.
The Author states that starting TorChat & logging in the tor network can sometimes take up to 15 Minutes (it takes around 1 minute for me)
The contents of the folder /var/lib/tor/hidden_service are your personal key. They must always be kept secret. If someone wants to impersonate your identity he must and will try to steal the contents of this folder from you.
Keep this always in mind. It would probably be a good idea to use TorChat in conjunction with something like TrueCrypt.
8.Removing TorChat
If you have installed torchat following 4. (from source) run:
sudo rm /usr/share/applications/torchat.desktop
sudo rm -R ~/torchat/In both cases, don't forget to safely delete the tor hidden_service directory /var/lib/tor/hidden_service/ with e.g. the shred tool!
Credits:
Bits & pieces for this howto were in true open source spirit shamelessly taken from:
- HOWTO surf anonymous by user dutch
- Torchat, written by prof7bit
- Truecrypt FAQ
- privoxy & tor manpages
- Installing SwitchProxy for Tor
- Ubuntu Forums
Howto: Create a SSH Tunnel for Firefox to surf securely!
A ssh tunnel for Firefox to a remote computer is good security measure. Especially when connecting via an untrusted network like a wifi hotspot or other public networks. The tunnel encrypts and sends the data to your remote machine then it is sent over the web to your destination. This tutorial assumes you have an account on a remote machine you can ssh into. This is a pretty easy set up.
Now all you need to do is login your remote computer that you have access to with SSH then issue this 1 command:ssh -D 9999 -C me@ipaddress.com
The -D switch - Specifies a local “dynamic” application-level port forwarding. We are also adding the -C switch for compression.
Next we need to put the settings into Firefox.
Firefox> Edit> Preferences> Advanced tab> Network tab> Settings button.
Select Manual proxy configuration
SOCKS Host: localhost Port: 9999
SOCKS v5
No Proxy for: localhost, 127.0.0.1
Note: Sometimes localhost can cause a problem. If your settings are right and it still is not working replace localhost with 127.0.0.1.