Inspirated

 
 

December 11, 2011

Fix disappearing Compiz skydome at login

Filed under: Blog — admin @ 1:49 pm

For a little while now I noticed that my Compiz skydome was disappearing whenever I logged in. I could bring it back by disabling and re-enabling the Cube plugin but from a cold-boot I was always greeted to an abysmal looking cube:

Compiz blank skydome
(Click on the thumbnail for larger version.)

A little bit of forensics revealed that the issue lied with the loading order of Compiz plugins. At the moment Compiz does not try to resolve any plugin dependencies at startup, so while the skydome relied on the PNG plugin the latter wasn’t pre-loaded — resulting in a blank background.

The solution was to change the following line in config:

[core]
s0_active_plugins = core;composite;opengl;copytex;decor;vpswitch;mousepoll;firepaint;gnomecompat;resize;compiztoolbox;wobbly;cube;screensaver;shift;scale;regex;imgpng;splash;place;move;obs;animation;rotate;expo;workarounds;freewins;ezoom;session;staticswitcher;

To:

[core]
s0_active_plugins = core;composite;opengl;copytex;decor;vpswitch;mousepoll;firepaint;gnomecompat;imgpng;resize;compiztoolbox;wobbly;cube;screensaver;shift;scale;regex;splash;place;move;obs;animation;rotate;expo;workarounds;freewins;ezoom;session;staticswitcher;

imgpng had to be loaded before cube, giving me back the pretty backdrop for all things 3D:

Compiz PNG skydome
(Click on the thumbnail for larger version.)

Tags: , , , , , ,

February 14, 2011

HOWTO: Access PSN on PS3 3.55 firmwares through Fedora

Filed under: Blog — admin @ 3:17 am

After a day of extensive Wireshark voyeurism I was finally able to connect to PSN on my 3.55 custom firmware through my Fedora box. This guide documents the procedure I used.

Requirements

The PC side of things:

  • Fedora 14. Any other Linux distro or even Windows machines can work, but since my primary OS is Fedora that’s what the guide shall be focusing on.
  • Internet connectivity on a separate interface than the one you’ll be connecting PS3 on. For example, my laptop connects through internet wirelessly while the PS3 is connecting to laptop through Ethernet.

The console side of things:

  • A custom firmware installed without level 2 patch. kmeaw is recommended.

Basic familiarity with Linux can be helpful. Please note that the guide requires you to mess with the flash memory of your PS3. If you aren’t paying attention you can end up with a FUBAR clinker.

Setting up the firewall

On Fedora, go to “Administration” > “Firewall” and provide the root password. In “Trusted Services”, enable the following:

DNS 53/tcp, 53/udp
DNS 53/tcp, 53/udp
Multicast DNS (mDNS) 5353/udp
Secure WWW (HTTPS) 443/tcp
WWW (HTTP) 80/tcp

In “Other Ports”, click on “Add” and select port 8888 for tcp.

Setting up a shared connection between Fedora and PS3

On Fedora:

  1. Connect to your wireless network.
  2. Right click on the Network Manager icon in the system tray and click on “Edit Connections”.
  3. Under the “Wired” tab, click on “Add”.
  4. Under the “IPv4 Settings” tab, select “Shared to other computers” as the method.
  5. Ensure that the “Connect automatically” box is checked.
  6. Click on apply.

On PS3:

  1. Under XMB, go to “Settings” > “Network Settings” > “Internet Connection Settings”.
  2. Select “Custom”.
  3. Select “Wired Connection”.
  4. Select “Auto-Detect for operation mode.
  5. Select “Automatic” for IP Address Setting.
  6. Select “Do Not Set” for DHCP host name.
  7. Select “Automatic” for DNS Setting.
  8. Select “Automatic” for MTU.
  9. Select “Do Not Use” for Proxy Server.
  10. Select “Enable” for UPnP.
  11. Connect the Ethernet cable and test the connection.

At this point, you should get the following result:

Obtain IP Address: Succeeded
Internet Connection: Succeeded
(A system software update is required. Go to [Settings] > [System Update] and perform the update.

To verify everything is working correctly, go to “System” > “Network Settings” >”Settings and Connection Status List”. You should see the following:

IP Address: 10.42.43.10
Subnet Mask: 255.255.255.0
Default Router: 10.42.43.1

Similarly, if you right click on the Network Manager icon in Fedora and click on “Connection Information”, you’ll see the following information for the shared connection:

IP Address: 10.42.43.1
Broadcast Address: 10.42.43.255
Subnet Mask: 255.255.255.0

As one last step for verification launch the Internet Browser on PS3 and see if it works.

Installing the proxy server

  1. Login as root.
    $ su -
  2. Download Charles for Linux.
    $ wget http://www.charlesproxy.com/assets//release/3.5.2/charles.tar.gz
  3. Extract the tarball:
    $ tar xvzf charles.tar.gz
  4. Change into the binary directory for Charles and add execute permissions to the launcher script:
    $ cd charles/bin/
    $ chmod a+x charles.sh
  5. Launch Charles:
    $ ./charles.sh
  6. Cancel the Firefox proxy configuration dialog. It isn’t needed for PS3.
  7. Go to “Tools” > “Proxy Settings” and ensure the HTTP Proxy is listening on port 8888.

On PS3:

  1. Launch “Settings” > “Network Settings” > “Internet Connection Settings” again.
  2. Use the same settings as before but under “Proxy Server” specify 10.42.43.1 as the address and 8888 as the port number.
  3. Test the connection. Charles should display a prompt about PS3 accessing the Internet, select “Allow”.

Just like before, ensure you can use the Internet Browse on PS3.

Finding the addresses of authorization and update servers

Restart your PS3 and try to sign in on PSN. Under the “Structure” tab in Charles you’ll see a server your console has communicated with during the process. For example, the “authentication” server is https://auth.np.ac.playstation.net:443/. In the list you’ll find the “update” server for your console (which differs from region to region). In my case, the update server was http://feu01.ps3.update.playstation.net/. Fire a console and find the IP addresses for both of these servers:

$ dig auth.np.ac.playstation.net

; <<>> DiG 9.7.2-P3-RedHat-9.7.2-5.P3.fc14 <<>> auth.np.ac.playstation.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 8848
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;auth.np.ac.playstation.net. IN A

;; ANSWER SECTION:
auth.np.ac.playstation.net. 2893 IN A 199.108.4.73

;; Query time: 46 msec
;; SERVER: 203.82.48.3#53(203.82.48.3)
;; WHEN: Mon Feb 14 00:45:40 2011
;; MSG SIZE rcvd: 60

$ dig feu01.ps3.update.playstation.net

; <<>> DiG 9.7.2-P3-RedHat-9.7.2-5.P3.fc14 <<>> feu01.ps3.update.playstation.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 16539
;; flags: qr rd ra; QUERY: 1, ANSWER: 5, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;feu01.ps3.update.playstation.net. IN A

;; ANSWER SECTION:
feu01.ps3.update.playstation.net. 3600 IN CNAME a01.cdn.update.playstation.org.edgesuite.net.
a01.cdn.update.playstation.org.edgesuite.net. 54582 IN CNAME playstation.sony.akadns.net.
playstation.sony.akadns.net. 300 IN CNAME a192.d.akamai.net.
a192.d.akamai.net. 20 IN A 195.95.193.10
a192.d.akamai.net. 20 IN A 195.95.193.100

;; Query time: 952 msec
;; SERVER: 203.82.48.4#53(203.82.48.4)
;; WHEN: Mon Feb 14 00:49:07 2011
;; MSG SIZE rcvd: 203

Jot down the server names and their IP addresses:

auth.np.ac.playstation.net 199.108.4.73
feu01.ps3.update.playstation.net 195.95.193.10
195.95.193.10

Configuring the proxy server

In Charles:

  1. Goto “Proxy” > “Reverse Proxies” and add two entries like this:

    Charles Reverse Proxies Screenshot
    (Click on the thumbnail for larger version.)

  2. Download a spoofed ps3-updatelist.txt.
  3. Goto “Tools” > “Map Local” and add the following entry (“Local Path” should point to the ps3-updatelist.txt you downloaded in the previous step):

    Charles Map Local Add Dialog Screenshot
    Charles Map Local Screenshot
    (Click on the thumbnails for larger version.)

  4. Goto “Tools” > “Rewrite”, check “Enable Rewrite” and add a new set.
  5. Use the following settings for location:

    Charles Rewrite Add Location Screenshot

  6. And the following for rules:

    Charles Rewrite Add Rule Screenshot
    (Click on the thumbnail for larger version.)

  7. The rewrite settings should now look like this:

    Charles Rewrite Screenshot
    (Click on the thumbnail for larger version.)

  8. Go to “Proxy” > “Proxy Settings” > “SSL” and add the entry auth.np.ac.playstation.net in locations table.

Rebuilding Network Manager to mask PSN IPs

This can be a PITA for Linux newbies. Network Manager uses dnsmasq but hardcodes the configuration. Leaving us without any way of affecting the shared connection’s behavior without recompiling the RPM. If people are really having trouble with this part I’ll upload the patched RPMs.

  1. Login as root:
    $ su -
  2. Install build dependencies for Network Manager:
    $ yum-builddep NetworkManager
  3. Download and install the source RPM for NetworkManager:
    $ yumdownloader --source NetworkManager
  4. Install the source RPM:
    $ rpm -ivh NetworkManager-0.8.1-10.git20100831.fc14.src.rpm

    This will create a rpmbuild directory under the home directory for root.

  5. Go to the SOURCES directory and download the patches:
    $ cd ~/rpmbuild/SOURCES/
    $ wget http://inspirated.com/uploads/nm-applet-remove-dialog-sep.patch
    $ wget http://inspirated.com/uploads/nm-psn-access.patch

    The first patch is a minor bugfix which causes compile errors. The second patche spoofs the authentication server’s IP address to 10.42.43.1 instead of 199.108.4.73. If you got a different IP address for auth.np.ac.playstation.net earlier with the dig command edit the second patch accordingly.

  6. Download and build the spec file:
    $ cd ~/rpmbuild/SPECS/
    $ wget http://inspirated.com/uploads/NetworkManager.spec
    $ rpmbuild -ba NetworkManager.spec

    If everything goes fine, the built RPMs shall appear in ~/rpmbuild/RPMS/<arch> directory.

  7. Install the RPM:
    $ cd ~/rpmbuild/RPMS/x86_64/
    $ rpm -Uvh --force NetworkManager-0.8.1-10.git20100831.fc14.x86_64.rpm
  8. Restart Network Manager:
    $ service NetworkManager restart

Installing the spoofed certificate on PS3

The spoofed certificate Charles uses to intercept SSL traffic is in the docs directory of the tarball (charles-proxy-ssl-proxying-certificate.crt). Rename it to CA02.cer, put it on a USB stick and then head over to your console.

  1. Install the AsbestOS installer and Comgenie’s Awesome Filemanager.
  2. Restart your PS3, launch the AsbestOS installer.
  3. The installer shall quit with an error about lack of level 2 access, press X to exit to XMB.
  4. Launch Comgenie’s Awesome Filemanager. You’ll see a new device called /dev_rwflash which is providing read/write support to PS3’s internal flash.
  5. Move to /dev_flash/data/cert, backup CA02.cer on your USB drive and replace it with the Charles certificate.
  6. Restart your PS3.

Gluing it all together

So far:

  • Fedora is sharing the Internet connection with PS3.
  • PS3 is using Charles as the proxy server.
  • Charles is all set to replace ps3-updatelist.txt as well as rewrite authentication headers.
  • NetworkManager is patched to mask the authentication server’s IP address to 10.42.43.1.
  • The CA02.cer certificate on PS3’s flash has been replaced by Charles’ spoofed certificate.

Try signing in to PSN now. You should see ps3-updatelist.txt file being mapped to the local version and 03.55 being replaced with 03.56 in the auth.np.ac.playstation.net header. If everything goes according to plan, this will be the result:

PSN SSL Trick Screenshot
(Click on the thumbnail for larger version.)

Tags: , , , , , , , , , , ,

November 17, 2010

HOWTO: Use animated XScreenSaver matrix backgrounds with Xfce

Filed under: Blog — admin @ 7:13 pm

Screensavers like glmatrix have long been used by *nixers to woo people by showing them customizable animations as desktop wallpapers. Users of desktop environments such as Xfce have to however use xwininfo to determine and use the window IDs of their desktops (as the “-root” option stops working when the root window is overlayed by respective desktop managers e.g., Xfdesktop). For those who want to automate the startup process of XScreenSaver wallpapers in such environments, here’s a quick command you can use:

$ /usr/libexec/xscreensaver/glmatrix -window-id $(xwininfo -name "Desktop" | grep 'Window id' | sed 's/.*\(0x[0-9a-z]*\).*/\1/g')

Results:

Xfce Matrix Screenshot #1
Xfce Matrix Screenshot #2
(Click on the thumbnails for larger versions.)

Tags: , , , , , ,

October 16, 2010

HOWTO: Play PS3 backups with files larger than 4 GB

Filed under: Blog — admin @ 8:28 pm

One of the common issues gamers are facing in transferring their backups between their PS3 and PC is the filesize limits for FAT32 filesystems (which happens to be the only one recognized by Backup Manager on external USB drives). Fortunately, a workaround exists for transferring >4GB files to PS3 from USB storage. First of all, you’ll need Comgenie’s Awesome Filemanager. Once you’ve got it up and running you can split any large file in the following manner:

Big.file
Big.file.1.part
Big.file.2.part
Big.file.3.part

Comgenie’s package comes with a file-splitter which splits following the pattern mentioned above. However, the utility runs only on Windows or Wine integrated with Mono. Fellow *nixers can use the handy split to the same effect. Here’s a shell script which I wrote for automating this task:

ps3split.tar.gz

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
 
if [ "$#" -lt "1" ]
then
    echo "Usage: ps3split inputfile"
    exit 1
fi
 
if [ "$(readlink -f .)" == "$(dirname "$(readlink -f "$1")")" ]
then
    echo "Cannot split files in the same directory as original"
    exit 1
fi
 
split --verbose \
      --bytes=4294967295 \
      --suffix-length=1 \
      --numeric-suffixes \
      "$1" "$(basename "$1").part."
 
old="$(basename "$1").part.0"
new="$(basename "$1")"
echo "renaming file \`$old\` -> \`$new\`"
mv "$old" "$new"
 
for old in $(basename "$1").part.*
do
    new=`echo $old | sed 's/^\(.*\).part.\(.\)$/\1.\2.part/'`
    echo "renaming file \`$old\` -> \`$new\`"
    mv "$old" "$new"
done

Use the script by providing it the path of a file you want to split:

[krkhan@orthanc ps3split]$ ./ps3split /mnt/bluray/PS3_GAME/USRDIR/TEKKEN.psarc

creating file `TEKKEN.psarc.part.0′
creating file `TEKKEN.psarc.part.1′
renaming file `TEKKEN.psarc.part.0` -> `TEKKEN.psarc`
renaming file `TEKKEN.psarc.part.1` -> `TEKKEN.psarc.1.part`

Transfer all the splitted files to your external harddisk and then copy the first part (`TEKKEN.psarc` in this case) using Comgenie’s Filemanager. It will automatically recognize the subsequent parts and join them together on the internal harddisk of PS3. I’ve tested the script on Tekken 6 and Red Dead Redemption and it worked flawlessly for both.

Tags: , , , , , , , ,

May 16, 2010

HOWTO: Query WordPress posts in CMS Made Simple

Filed under: Blog — admin @ 3:53 pm

While I run my blog at inspirated.com, I aggregate posts related to coding at the subdomain code.inspirated.com. The websites are run through WordPress and CMS Made Simple respectively.

For the latter, I needed to find a way of fetching blog posts from the main site for linking. Initially, I used tag feeds for this purpose. That is, I used the RSS module for CMS-MS and fetched the feed for a particular tag (e.g., inspirated.com/tag/code/feed). This worked well for a while until the feeds became large and I noticed that only the most recent 10 posts were showing up in the listings.

Digging around, I found this piece of documentation which explains how one can use custom queries for collecting WordPress posts from a blog. There was a catch however as the code for doing so could only be run globally. In other words, if I tried running the code mentioned on the page inside a User Defined Tag in CMS-MS I would get strange errors.

The solution was to run the code in a separate PHP file. Here’s how:

  1. Create a file named wp.php in your CMS-MS folder with the following code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    
    <?php
    require_once('/path/to/wordpress/wp-blog-header.php');
    // edit the path in the line above to point to your wp-blog-header.php
     
    $tag = isset($_REQUEST['--tag']) ? $_REQUEST['--tag'] : 'code';
    $count = isset($_REQUEST['--count']) ? $_REQUEST['--count'] : '-1';
    $after = isset($_REQUEST['--after']) ? $_REQUEST['--after'] : '1970-01-01';
     
    function filter_where($where = '') {
        global $after;
        $where .= " AND post_date >= '".$after."'";
        return $where;
    }
    add_filter('posts_where', 'filter_where');
     
    query_posts('tag='.$tag.'&posts_per_page='.$count);
     
    echo "<ul>";
    if ( have_posts() ) : while ( have_posts() ) : the_post();
        echo "<li>";
        echo "<a href=\"";
        echo the_permalink();
        echo "\">";
        echo the_title();
        echo "</a>";
        echo " (";
        echo the_time('F jS, Y');
        echo ")";
        echo "</li>\n";
    endwhile; else:
        echo "<li>No posts found</li>\n";
    endif;
    echo "</ul>";
     
    wp_reset_query();
    ?>
  2. Add a User Defined Tag in CMS-MS with the following code:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    $path = 'whoami | php -q /path/to/wp.php';
    // edit the path in the line above to point to the wp.php created in previous step
     
    // whoami command piped for no reason because my script wasn't
    // producing any output without it
     
    if(isset($params['tag'])) {
        $path .= ' --tag='.$params['tag'];
    }
     
     
    if(isset($params['count'])) {
        $path .= ' --count='.$params['count'];
    }
     
    if(isset($params['after'])) {
        $path .= ' --after='.$params['after'];
    }
     
    echo `$path`;
  3. Use the tag in any CMS-MS page with any of the following combinations:
    • List all posts with the tag code:
      {wp_posts_with_tag tag="code"}
    • List 10 posts with the tag code:
      {wp_posts_with_tag tag="code" count="10"}
    • List all posts with the tag code after May 1st, 2009:
      {wp_posts_with_tag tag="code" after="2009-05-01"}

Custom queries are very powerful once you get them working. Anyone planning on using them should take a look at the function reference for getting to grips with the flexibility they offer.

Tags: , , , , ,

April 11, 2010

Workaround for getting received SMS’ sender number in PyS60

Filed under: Blog — admin @ 9:22 pm

It’s fairly simple in PyS60 to get the sender’s details whenever a new SMS is received. However, if the sender has an entry in your address book these details translate to just the contact name. That way, if the contact has multiple numbers you have no idea which number was used to send the text. Here’s an ugly little workaround for this issue:

received-sms-number.py

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def message_received(id, box):
    box.sms_messages()
    sender = box.address(id)
 
    if sender[0] != '+' or sender[1:].isdigit() == False:
        # Try to find the sender's number from log.
        logged_sms = logs.sms(mode = 'in')[0]
 
        # To confirm that the log entry is the same one we're concerned
        # about, do some checks.
        if logged_sms['subject'] == sms_text[:64]:
            number = logged_sms['number']
            contacts_db = contacts.open()
            found_contact = contacts_db.find(number)
            if found_contact:
                title_match = True
                for token in sender.split():
                    if found_contact[0].title.find(token) == -1:
                        title_match = False
                if title_match:
                    sender = number
 
    print "SMS Received from: ", sender

You can use this little snippet of code to reply back to the sender even when there’s a matching entry in the contacts database. This in turn opens up a whole new range of interesting ideas for auto-responding applications.

Tags: , , , , , ,

August 23, 2009

Workaround for fixing X.org acceleration issues on Intel chipsets

Filed under: Blog — admin @ 1:39 pm

Recent X.org drivers for Intel chipsets have introduced a new acceleration method called UXA which is supposed to provide “simpler, faster” code. However, for whatever reason, this bleeding-edge feature actually results in a loss of performance and reliability for particular chipsets (e.g. 915 family) on most distributions (Fedora and Ubuntu to name the foremost). In order to work around these issues, two solutions can be used:

  1. Enable Tiling in xorg.conf.

    Section "Device"
    	Identifier  "Videocard0"
    	Driver      "intel"
    	Option      "Tiling" "False"
    EndSection

    This fix does help the low framerate issue encountered on most distros, but it introduces screen tearing on some installations and worse, can happen in occasional X crashes as well.

  2. Use “greedyMigrationHeuristic with EXA instead:

    Section "Device"
    	Identifier  "Videocard0"
    	Driver      "intel"
    	Option      "AccelMethod" "EXA"
    	Option      "MigrationHeuristic" "greedy"
    	Option      "NoDDC"
    EndSection

    While this completely bypasses the UXA acceleration, it seems to work well for most users.

For the time being, I’m sticking with the second workaround since I have no issues with using the older acceleration architecture until the new one achieves some decent stability.

Tags: , , , , , , , , ,

July 2, 2009

Workaround for autostarting applications in a particular order on Xfce/GNOME/KDE

Filed under: Blog — admin @ 11:04 pm

Among many of freedesktop.org’s vital contributions to GUI computing on POSIX platforms, a divine one has been the uniform specification for automatically launching programs at initiation of a desktop session. Informally put (or theoretically at least), it means that you can add programs to startup in the appropriate settings, and they will be launched automatically at initiation of your session regardless of which desktop environment you use.

It’s been about 4 years since I migrated to Xfce for everyday work and it does come with a basic tool for managing startup entries (accessed through Application Menu > Preferences > Session and Startup). Still, if you need anything more than rudimentary addition/deletion of the entries you’re pretty much out of luck. For example, I wanted to start the applications in a particular order. I don’t know whether GNOME or KDE have the feature yet, but Xfce lacked the support for maintaining any such arrangement. The proper way to deal with the issue would have been to code the feature in the session manager myself, but since I barely get time to even read fortune-mod these days I instead had to rely on an ugly workaround. If you’re in the same sticky situation, here it is: Go to the autostart directory (usually ~/.config/autostart), open the startup script you’re concerned with, and edit the Exec line like this:

Before:
Exec=awn-autostart

After:
Exec=bash -c "sleep 3 && awn-autostart"

The ugliness arises from the fact that the new Exec line is merely launching the program with a delay of 3 seconds. Now, you can add another program with a delay of 4 and it will almost be guaranteed to start after the 3 seconds’ one across all desktop environments. I really hope that the specification itself would be revised soon to provide a uniform way of setting the startup order. But until that gets done, I can thank sleep for making my life simpler.

Tags: , , , , , ,

May 6, 2009

Breaking the ISP shackles on Huawei SmartAX MT 882

Filed under: Blog — admin @ 10:56 am

What does an ISP do when it needs to sell a customized router? Well, if they’re smart, they go for a Chinese product; re-brand it as their own, slap stupid restrictions on it and then shove the whole thing down the customers’ throats.

Last year, when I came to Saudi Arabia on vacations, I got ADSL installed on my phone-line. As mentioned above, a Huawei SmartAX MT 882 was provided by the ISP. Interestingly, it came not only with a re-branded appearance, but also with a customized firmware which purged all Huawei logos and references from the administration interface. As a side note, switching from a Linksys WAG200G (which I had back in Pakistan) to the Huawei thing was more or less like transitioning from GIMP/Photoshop to MS Paint. For example, even though I had UPnP enabled on the goddamned Chinese weapon, it never worked. Leaving me no alternative but to forward the ports manually.

Back to the topic, the device worked halfway decently. That is, until I came back during these vacations and bought the ADSL service from a different ISP. As soon as I popped up the configuration interface to type in the ADSL credentials, I was hit with this:

Huawei SmartAX MT882 Configuration Interface

See any issues? The username is already tied to the older ISP. My new username is something like “[a-number-I-can't-remember]@1024.nesma.net.sa“. The configuration interface only allows me to type in the [number-I-can't-remember] part, effectively allowing usernames only of the format: “[a-number-I-can't-remember]@1024.afaqe2e.com“. Because of the old ISP’s bitch-ingly idiosyncratic attempt of monopolizing sales, I apparently needed to buy another router to work with the new username.

Hell, no. If I had actually went ahead and bought another router for this reason alone, I might’ve as well stopped calling myself a geek. Looking for a fix, the first thought that naturally occurred to me was to try and flash the firmware. Again, firmware flashing for such crippled devices isn’t any less of a bitch either. Curiously, I opened up the source of the interface webpage. Apart from a total mess of tag-soup the likes of which I had only ever seen in FrontPage websites, I spotted this:

<INPUT type="hidden" size="30" maxlength="63" name="pppuser" VALUE="51252403762@1024.afaqe2e.com">
<INPUT type="text" name="pppuser_prefix" SIZE="20" MAXLENGTH="35" VALUE="51252403762">
@<INPUT type="text" name="rate" SIZE="5" MAXLENGTH="15" VALUE="1024">.afaqe2e.com

Er.. a hidden input field that basically contains the whole username. What for? I had and still have no idea. Nevertheless, it gave me a clue that the "afaqe2e.com" part is not hard-coded in the customized firmware. That is, if I could only manage to somehow input the new username unmodified in the router, it should still work.

Bling.

  • Backup the router configuration.
  • Open it in a text editor.
  • Search for the username.
  • Change it.
  • Save the file and “restore” it through the administrative interface.
  • Restart the device, and stick a middle finger to the monopolizing ISP’s.
  • Pat yourself on the back for being the William Wallace of home internet gateways.
Tags: , , , , , , , , , , , , ,

April 7, 2009

HOWTO: Log Pidgin conversations selectively

Filed under: Blog — admin @ 7:32 pm

Pidgin is a multi-protocol instant-messaging client which I use for all my MSN/Google Talk/IRC communication. Apart from offering adept support for all of these protocols (and plenty others as well), Pidgin also provides decent logging support. However, I’m not at all interested in having my daily MSN conversations recorded. On the other hand, I prefer having my previous IRC chats with me for reference. Right now, Pidgin does not support any options in the Preferences which would allow me to selectively turn on logging based on the protocols I’m using. If I turn it on for chat windows, it also starts producing logs for every MSN chat I participate in.

Most of the people wouldn’t/don’t see any issue with this behavior. For those who do want to keep a history of their conversations only for particular protocols, here’s a quick workaround for doing it:

  • Check the appropriate options under the “Logging” tab in Preferences window.
  • Have a few chats the likes of which you’d prefer being logged.
  • Go to the directory containing Pidgin logs (default is ~/.purple/logs):
    [user@host ~]$ cd ~/.purple/logs/
  • See whether the protocols you want to be logged have a directory named for them:
    [user@host logs]$ ls

    irc msn

  • Remove the protocols you do not want to have logs for (in my case, MSN):
    [user@host logs]$ rm -rf msn
  • Change directory permissions to stop new protocols from getting logged:
    [user@host logs]$ chmod 500 .

And you’re done. Now, whenever you start a conversation in a protocol which does not have a respective directory in ~/.purple/logs, you’ll see a “Logging failed” error message in the conversation window. For other (allowed) protocols, logging will work as expected. To turn off selective logging, reset directory permissions with:

[user@host ~]$ chmod 600 ~/.purple/logs/

It is also possible to apply the same workaround on contacts. For example … :

  • [user@host ~]$ cd ~/.purple/logs/msn/
    [user@host msn]$  ls

    bestbuddy@live.com ignorantmoron@live.com

  • [user@host msn]$ rm -rf ignorantmoron@live.com
  • [user@host msn]$ chmod 500 .

… will disable logging for all MSN contacts including ignorantmoron@live.com, but will record everything communicated with bestbuddy@live.com. Like the previous example, you just have to reset directory permissions to re-enable nondiscriminatory logging:

[user@host ~]$ chmod 600 ~/.purple/logs/msn/
Tags: , , , , , , , , , ,