Sniffing Unix Domain Sockets

Usually wireshark is used to sniff packets traversing a network. But how does one sniff a unix domain socket? Using socat as a proxy is a neat trick to capture packets traversing a unix socket.

In the below command, /tmp/originalsocket is the socket the Unix Socket Server is listening on, while /tmp/duplicatesocket is the socket that the unix client should connect to. socat will dump all the transactions that go on in a hexadecimal format

sudo socat -t100 -x -v UNIX-LISTEN:/tmp/duplicatesocket,mode=777,reuseaddr,fork UNIX-CONNECT:/tmp/originalsocket

Pratik Sinha

November 20, 2013

Restart Unity From the Terminal

pkill --signal USR1 unity

Multiple Github Accounts and SSH Keys

Besides my regular Github freethinker account, I had to create a new github account for my new job. Problem was how to manage different ssh keys for different github accounts as Github doesn’t allow the same key for more than one account. The Solution is:

1) Create a new alias for github.com in the ~/.ssh/config file.

Host GitHub-readme
  Hostname=github.com
  IdentityFile=~/.ssh/id_rsa_alt

This alias still points to github.com but when you ssh into github using the new alias, it will use the alternative SSH key. It should be noted that Github recognizes you not by your username but by your ssh key.

Before you go on, do remember to ssh-add the key.

ssh-add ~/.ssh/id_rsa_alt

To verify whether the ssh key has been added or not

ssh-add -l 

2) Next, lets verify if our new configuration works with github. To do so, execute ssh -T git@GitHub-readme, where GitHub-readme is the new alias we created in step one with an alternative ssh key.

@~ $ ssh -T git@GitHub-readme
Hi pratikreadmesys! You've successfully authenticated, but GitHub does not provide shell access.

3) Finally either clone a new repository or edit the .git/config of your present repository. Use the new alias that we created in step 1 instead of ‘github.com’ in the command line.

git clone git@GitHub-readme:ReadmeSystemsInc/testrepository.git

Alternatively if you have already checked out the repository, update the remote URL.

[remote "origin"]
  url = git@GitHub-readme:ReadmeSystemsInc/testrepository.git
  fetch = +refs/heads/*:refs/remotes/origin/*

Work log for Truth of Gujarat – FB Plugins

http://www.truthofgujarat.com

Installed a combination of the following plugins

http://www.wordpress.org/plugins/social

Social is being used to post snippets to facebook, and also sync back comments. Used this over inbuilt (jetpack) publicize as social has the ability to sync back comments to the native wordpress format. Disabled the commenting form of social and using ‘Comments evolved instead’

http://wordpress.org/plugins/gplus-comments/

Comments evolved enabled a multi-tabbed interface which supports various commenting mechanisms, the currently enabled ones are wordpress, facebook and google plus in that order.

Testing Wp-book lite on humbug.in through this post, to see if this can be used instead of social.

 

Work Log – Truth of Gujarat – Social Plugin

Work log for http://www.truthofgujarat.com

Changes made to the social plugin for wordpress.

lib/social/service/facebook.php

public function max_broadcast_length() {
return 600;
}

Changed it from 420 to 600 to increase the post length thats posted to fb

//$this->search_for_likes($account, $broadcasted_id, $id[0], $post, $like_count);

commented this bit to skip fetching of likes

——————————————————————————
lib/social/service/twitter.php:152

// Retweets
foreach ($broadcasted_ids as $broadcasted_id => $data) {
continue;

added a continue statement so that fetching of retweets is skipped

Also testing WPBook through this post to see if it can be used on http://www.truthofgujarat.com

Enable Netfilter/Iptables on ArchLinux

I was surprised that iptables modules are not loaded automatically on ArchLinux. Here’s how you load them. Dump the following lines in any file (for eg. netfilter.conf) under modules-load.d and restart your machine. Alternatively load the modules manually if you want to avoid restarting.

@~ 1028$ cat /etc/modules-load.d/netfilter.conf 
x_tables
ip_tables
iptable_filter
iptable_mangle
nf_conntrack
nf_defrag_ipv4
nf_conntrack_ipv4
nf_nat
iptable_nat