GOOMWWM Keybinding

15 July 2014

Keyboard shortcuts become a thing of the past when you’re running a minimal window manager such as GOOMWWM. I decided to use XBindKeys, a grabbing keys program for X.

XBindKeys uses a configuration file, located at $HOME/.xbindkeysrc.

Contents of my .xbindkeysrc

"gnome-terminal"
  Mod2 + F12

You can create your own config, or have a default one generated for you.

xbindkeys --defaults > $HOME/.xbindkeysrc 

To get the correct key codes, you can use -k to identify key presses. It will open a blank window and output the command to be placed into your configuration file.

xbindkeys -k

XBindKeys should be easily found in your package manager.


iptables pcap log

23 March 2014

ULOG is the netfilter/iptables logging daemon. It connects to the netlink device of the Linux kernel and reads messages from the netfilter that get queued with the iptables ULOG target. It can output to plain text, MySQL, Postgres and PCAP.

Install with:

apt-get install ulogd-pcap 

Configure ulogd to output in PCAP format

 vim /etc/ulogd.conf

Un-comment plugin="/usr/lib/ulogd/ulogd_PCAP.so", restart ulog. Then add a log rule to iptables before the final drop rule.

-A INPUT -j ULOG

The PCAP log file should be located at /var/log/ulog/pcap.log


LaTeX Install .cls

20 March 2014

Installing a LaTeX class in three simple steps.

locate article.cls

Copy your .cls file to the same directory.

sudo cp yourclsfile.cls /usr/share/rest/of/the/path/from/above

Update the kpathsea database.

sudo texhash

MAC Spoofing

11 February 2014

There are times when you want to change your MAC address, be it for fun, by-passing time restrictions or for development reasons.

For Linux there is a nice small tool which does this for you. It’s called macchanger. You can download and compile it or install it with your package manager.

For example, on Debian/Ubuntu you can do:

sudo apt-get install macchanger

Make sure you are not connected to the network first, and bring down your interface. In this case it’s my wireless interface, you may want to use your ethernet, which might be eth0.

sudo ifconfig wlan0 down

Now we change the end of the MAC address which will change your address but keep the same vendor bytes. For more information about this read up on MAC addresses

sudo macchanger -e wlan0

Now bring the interface back up, and connect to the network using your network manager.

sudo ifconfig wlan0 up

Check if we still have the new address.

macchanger wlan0

You should see something like this, if your current address is different then all is good.

Permanent MAC: 00:2F:77:36:57:F4 (Intel Corporate)
Current   MAC: 00:2F:77:F4:CE:02 (Intel Corporate

MACSpoof-CLI


Script to get HTTP Headers

02 August 2013

The below script uses urllib2 to connect to the given URL(s) then prints out the HTTP headers.

http-server-header.py

#:/bin/python
import urllib2, sys

if len(sys.argv) == 1:
	print "Please feed me a URL...\n\n<3\n"
	sys.exit(0)

for url in sys.argv[1:]:
	r = urllib2.urlopen(url)
	print 'URL: ' + url + '\n' + str(r.info())

An example of it working is shown below. From a “security through obscurity” view, you’d want to conceal your HTTP server information.

$ python ~/http-server-header.py http://nationpigeon.com
URL: http://nationpigeon.com
Server: nginx/1.2.1
Date: Mon, 05 Aug 2013 01:10:19 GMT
Content-Type: text/html
Content-Length: 650
Last-Modified: Mon, 29 Jul 2013 08:46:57 GMT
Connection: close
Accept-Ranges: bytes

goomwwm startup applications and background

24 January 2013

I’ve been using Goomwwm on and off, but seeing as it’s post-new-yearness I’m going to give it a try full time.

To set the background, I decided to use feh.

Simply create a .goomwwmrc in your home directory.

# Background
exec /usr/bin/feh --bg-center /home/osaka/wallpaper.jpg

# Sart up applications
exec /usr/bin/lxpanel

That sets the background to an image in my home directory and start lxpanel up once goomwwm has started.

From here you should be able to work out how to start other applications. Simply prefix the application location with the command ‘exec’


Connect to Eduroam using wpa_supplicant

24 January 2013

I can never remeber how it’s meant to work, which normally results in lots of authentication errors and google queries.

Less: /etc/wpa_supplicant/wpa_supplicant_edu.conf

ctrl_interface=/var/run/wpa_supplicant
eapol_version=1
ap_scan=1
fast_reauth=1

network={
        ssid="eduroam"
        key_mgmt=IEEE8021X WPA-NONE WPA-EAP
        eap=PEAP
        identity="abc1@uni.ac.uk"
        password="*****"
        #ca_cert="/location/of/cert" # This might not be required.
        phase2="auth=MSCHAPV2"
        priority=2
        auth_alg=OPEN
}

As this will contain your password make sure that only root has read access!

That’s all there is to it. But seeing as I have done this in Arch Linux I’ll include the extra steps taken to get it fully working.

Created a netcfg profile.

Less: /etc/network.d/wlan0-eduroam

CONNECTION="wireless"
INTERFACE=wlan0
SCAN="no"
SECURITY="wpa-config"
ESSID="eduroam"
IP="dhcp"
TIMEOUT=30
WPA_CONF="/etc/wpa_supplicant/wpa_supplicant_edu.conf"

You should now be able to connect to eduroam with netcfg wlan0-eduroam

And to make it auto connect you need to add the profile to /etc/conf.d/netcfg. See netcfg


Eclipse and Android Dev

02 September 2012

If you get the following error with Eclipse on Linux (Maybe Windows):

Cannot complete the install because one or more required items could not be found.
  Software being installed: Android Development Tools 0.9.4.v200910220141-17704 (com.android.ide.eclipse.adt.feature.group 0.9.4.v200910220141-17704)
  Missing requirement: Android Development Tools 0.9.4.v200910220141-17704 (com.android.ide.eclipse.adt.feature.group 0.9.4.v200910220141-17704) requires 'org.eclipse.wst.sse.core 0.0.0' but it could not be found
  1. Go to Help->Install Software
  2. Click on “Available Software Sites”
  3. Set “check” on check box - http://download.eclipse.org/releases/helios (for helios - Eclipse 3.6 )
  4. Try to install Android Development Tools

vnstat: Network Stats

19 August 2012

To gather network statistics for your interfaces, have a look at vnstat

vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won’t actually be sniffing any traffic and also ensures light use of system resources.

vnstat example

This is how to install on Debian:

apt-get -y install vnstat vnstati

Configure which interface to monitor, this will create a database.

vnstat -u -i eth0

If you don’t do this step you will get the following error:

Setting up vnstat (1.10-1) ...
Starting vnStat daemon: vnstatdZero database found, exiting.
 failed!

FreeBSD 9 Keyboard mapping

18 August 2012

To get HAL to set your keyboard mapping on boot create the below file:

vi /usr/local/etc/hal/fdi/policy/x11-input.fdi

Enter this into it:

<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
  <device>
    <match key="info.capabilities" contains="input.keyboard">
      <merge key="input.x11_options.XkbLayout" type="string">gb</merge>
    </match>
  </device>
</deviceinfo>

For this to work you will need to have HAL enabled in rc.conf.

echo 'hald_enable="YES"' >> /etc/rc.conf
echo 'dbus_enable="YES"' >> /etc/rc.conf