DMA Don’t Contact LOL

June 26, 2012

The DMA Don’t Contact database is a bit of an oxymoron, and a joke.

But after the recent weeks’ spate of machine dialed spam, and human dialed spam, I’ve decided to give it a whirl.

  • The oxymoron is that the Don’t Contact me Database, contacts you.
  • And then the joke is that they cannot fucking spell.

 

I summarily reported the validation link as SPAM, so let’s hope that keeps them busy a while.

 

 



 

 Ericsson F3507g under Linux

June 19, 2012

After tearing my hair out making my Thinkpad’s Ericsson Business Mobile Networks BV F3507g Mobile Broadband Module work like it should I found the solution.

Without some magic initialization strings, whenever you create a PPP connection using pppd, you will simply get some cruft like the following

Connect: ppp20 <--> /dev/ttyACM1
sent [LCP ConfReq id=0x1 ]
rcvd [LCP ConfReq id=0x2 ]
sent [LCP ConfAck id=0x2 ]
rcvd [LCP ConfAck id=0x1 ]
sent [LCP EchoReq id=0x0 magic=0x7ee90359]
rcvd [LCP EchoRep id=0x0 magic=0xd1304c29]
rcvd [CHAP Challenge id=0x0 <4c95aa9b38117677e44d021350494e6f7c055a8b6881266714bdb20380b9fe5fac750a7b98f1d657442d62f3b029ae4fdce5ba6bc8618647749d12e3e0995e>, name = "Kermit"]
sent [CHAP Response id=0x0 <068d69fa57a15daa762f3d4ea548e605>, name = "xxxxx"]
rcvd [CHAP Success id=0x0 "Congratulations!"]
CHAP authentication succeeded: Congratulations!
CHAP authentication succeeded
sent [IPCP ConfReq id=0x1 ]
rcvd [LCP TermReq id=0x1]
LCP terminated by peer
sent [LCP TermAck id=0x1

The key being “LCP terminated by peer”. This modem seems to be faking a lot of stuff on the PPP layer, and the termination is actually initiated by the modem, and not the actual network itself, causing one to do some serious headscratching.

The magic, is in the following initialisation string, that you add to your chat script.

OK AT+CFUN=1

Yes, that’s right, lets have FUN=1 !

Without that bit in the init string there is no PPP to be had. Your connections will always report “Congratulations!” and then summarily disconnect.

You can also use AT+CFUN=5 for GSM/GPRS only mode or AT+CFUN=6 for 3G only mode.

Herewith a complete /etc/ppp/peers/fuckyouericsson chat script

ABORT BUSY
ABORT VOICE
ABORT "NO CARRIER"
ABORT "NO DIALTONE"
ABORT "NO DIAL TONE"
ABORT "NO ANSWER"
ABORT "DELAYED"
ABORT "ERROR"
ABORT "+CGATT: 0"

TIMEOUT 12
"" AT
OK ATQ0V1E1S0=0&C1&D2+FCLASS=0
#REQUIRED TO MAKE THE MODEM ACTUALLY DO PPP
OK AT+CFUN=1
#set the APN
OK AT+CGDCONT=1,"IP","internet","0.0.0.0",0,1
OK ATD*99***1#
TIMEOUT 22
CONNECT ""



 

 Alles Komputer

May 24, 2012

I hate internationalisation. There is nothing as crap, as internationalisation. Once an OS starts getting internationalised it starts dragging with it a pile of shit, known as locales, languages, unicode, and god knows what other crap that all contributes to the bloat, slowdown and general utter uselessness that comes with a Linux distro.

Let me explain why I hate internationalisation.

1. Internationalisation breaks monitors

I use grub2, the default debian bootloader. I hate the fact that grub2 decides to switch to a fancy videomode, so that it can display unicode characters. I like my machine to boot up, in good old 80×25 text mode, thank you. No mode changes. Why no mode changes ?

Because mode changes causes my monitor to adjust sync, blank out, and do all kinds of crap I don’t want it to. It makes me me miss important boot information, and reduces the lifespan of my old CRT.

Mode switching also causes major crap with KVM tools such as HP’s ILO, or SuperMicro IPMI, especially when you’re remote consoling a box over a laggy connection (when is it ever NOT laggy?).

Once again, this stops you from using a computer usefully, which is kinda the frigging point, right ?

Fixing this on debian, is a royal PITA as well.

Observe, from grub.cfg on debian

function load_video {
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
}

if loadfont /usr/share/grub/unicode.pf2 ; then
set gfxmode=640x480
load_video
insmod gfxterm
fi

I don’t want that shit, thankyouverymuch, fuckoff.

So, to get around this crap on debian, we have to edit /etc/default/grub, and add

GRUB_VIDEO_BACKEND=dummy

because just

GRUB_VIDEO_BACKEND=

still causes update-grub to load all the vga drivers, and using

GRUB_VIDEO_BACKEND=vga

to force what I thought to be plain old vga, still let grub get it’s grubby paws onto a module that caused a mode switch. That took like an hour to sort out. Hopefully it saves someone some time.

All of this, in the name of presenting a UNICODE fucking font to some non-ASCII dude who probably doesn’t even understand what a bootloader is.

2. Internationalisation breaks keyboards, and monitors

The default debian console-setup gives us UTF-8, and Cyrrilic characters, and in order for it to support this, it has to adjust the console font, which fucks around with the VIDEO MODE yet again. This is an intricate arrangement between the keyboard setup, console setup, and god knows what.

The debian installer doesn’t ask all the questions that a ‘dpkg-reconfigure console-setup’ does, but suffice it to say that if you run it, you finally get given the option on NOT CHANGING THE VIDEO MODE DUE TO KEYBOARD SETTINGS.

Simply choose “Do not change the boot/kernel font” when asked about “Font for the console:”

Or to make the problem go away in an easier fashion, and save the planet by saving CPU cycles, disk space and that pain in your arse:

dpkg --purge console-common console-data console-setup console-terminus console-tools kbd keyboard-configuration

What you are now left with, is glorious, raw ASCII, C based console, the way God and Linus Torvalds intended. Your system bootup time will probably also have decreased by a few seconds.

Greenpeace will love you. I like Greenpeace, I contribute every month.

3. UNICODE Sucks

There’s a reason I’ve always used

LANG=C

in my /etc/environment file. It makes me avoid the bullshit that is UNICODE.

If you have ever seen crap funny characters like

· --where=âwhere_conditionâ, -w âwhere_conditionâ

when viewing a man page, for example on a Redhat box, then you have been the victim of unicode. Unicode is the most stupid idea for “fixing” a working system of character representation that is based on 8 bits, by attempting to hack on more bits, just so that some muppet can see his Chinese character.

What you see is not what you get, and all thanks to someone that doesn’t understand ASCII wanting to see what they get.

I cannot for the life of me think of a more fucked up hack than Unicode.

4. Internationalisation wastes power, and cpu cycles.

In debian squeeze, putting “LANG=C” in your /etc/environment file is somehow “deprecated”. (What, putting an environment variable in the obviously located file is deprecated?)

You are now supposed to stick “LANG=C” into your /etc/default/locale file, which is simply sourced at the same time as /etc/environment would have been sourced.

This is not a biggy, except that some fucking muppet decided it would be a great idea if cron whined about the fact that you are using a “deprecated” file.

Observe, from /etc/init.d/cron, on squeeze

for var in LANG LANGUAGE LC_ALL LC_CTYPE; do
value=`egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2`
[ -n "$value" ] && eval export $var=$value

if [ -n "$value" ] && [ "$ENV_FILE" = /etc/environment ]; then
log_warning_msg "/etc/environment has been deprecated for locale information; use /etc/default/locale for $var=$value instead"
fi
done

A few comments on the above fucked-ness.

  1. You dumb shit package maintainer
  2. Thanks for wasting CPU cycles to warn me about a supposedly “deprecated” file, that is fo-sho, NEVER FUCKING GOING TO GO AWAY.
  3. Why the fuck does cron care about any of this shit ? Cron runs shit at intervals. That is all.

Oh wait, I can answer point 3.
(from /etc/init.d/cron)

# Read the system's locale and set cron's locale. This is only used for
# setting the charset of mails generated by cron.
To provide locale
# information to tasks running under cron, see /etc/pam.d/cron.
#
# We read /etc/environment, but warn about locale information in
# there because it should be in /etc/default/locale.

So, all of those CPU cycles were wasted, so that the correct character set can be used for the mails generated by cron. Holy fuck! WAT ?

5. Internationalisation make for insecure software

You need only to google “unicode exploit” to understand the size of the problem. Bytestreams that get interpreted differently based on a file stored on disc, that contains a language and an alternative character set that is managed by a complicated library is just asking for shit.

Language library programmers don’t focus on security, they focus on functionality

6. Internationalisation wastes time, money and resources

I’ve seen some Chinese engineers at work on their glyphical desktops, and if I just think about the amount of time that Microsoft, and other companies have spent, translating every little error message, into every language and character set across the globe — the mind boggles.

I think we’d probably be able to feed every hungry soul on the planet with that kind of effort and money.


To summarize:

  • Yes, I’m old skool.
  • Alles komputer must run LANG=C, English, and ASCII.
  • No, I don’t hate your culture/language/character set, just don’t break mine in the process of fulfilling your glyphical fantasy
  • If this is above your abilities then your rights to compute must be revoked
  • Internationalisation contributes to global warming
  • The sooner the planet speaks a single language, and uses a single character set the better
  • That is all.


 

 php-fuse, user-space file systems implemented in PHP

May 10, 2012

Creating a filesystem with FUSE, and PHP is quite easy, once you’ve read the code, read up about fuse and done about three hours of research. Ergo, it’s a fucking bitch.

If you’re lazy, or in a rush I’ve collated some of the steps, and filtered some of the crap. Hopefully this helps someone in the future.

I’m using it to do some nifty things for work, and plan to extend it for some more nifty things for my hobby, which at the moment is transcoding of video and rewriting lots of DLNA servers.

1.) Build the gree php-fuse module:

apt-get install libfuse2 libfuse-dev fuse-utils fuse-module php5-cli php5-dev
wget https://github.com/fujimoto/php-fuse/tarball/master -O php-fuse.tar.gz
tar xvfz php-fuse.tar.gz
cd fujimoto-php-fuse-*
phpize
./configure
make
make test
sudo make install

2.) Use the following php-cli script to test


#!/usr/bin/php -n
<?php
// vim: set sw=4 sts=4 et tw=100 smarttab :

dl("fuse.so");

class FuseTest extends Fuse {

        public function getdir ($path, &$retval) {
                echo("FuseTest:getdir: $path\n");
                switch ($path) {
                        case "/" : {
                                $retval["."] = array ('type' => FUSE_DT_DIR);
                                $retval[".."] = array ('type' => FUSE_DT_DIR);
                                $retval["subdir"] = array ('type' => FUSE_DT_DIR);
                                $retval["test.txt"] = array ('type' => FUSE_DT_REG);
                                break;
                        }
                        case "/subdir" : {
                                $retval["."] = Array ('type' => FUSE_DT_DIR);
                                $retval[".."] = array ('type' => FUSE_DT_DIR);
                                $retval["test2.txt"] = array ('type' => FUSE_DT_REG);
                                break;
                        }
                        default : return -FUSE_ENOENT;
                }
                return 0;
        }

        public function getattr ($path, &$st) {
                echo("getattr: $path");
                $st['dev'] = 0;
                $st['ino'] = 0;
                $st['mode'] = 0;
                $st['nlink'] = 0;
                $st['uid'] = 0;
                $st['gid'] = 0;
                $st['rdev'] = 0;
                $st['size'] = 0;
                $st['atime'] = time();
                $st['mtime'] = time();
                $st['ctime'] = 0;
                $st['blksize'] = 0;
                $st['blocks'] = 0;


                if ($path == "/" || $path=="/subdir") {
                        $st['mode'] = FUSE_S_IFDIR | 0775;
                        $st['nlink'] = 3;
                        $st['size'] = 0;
                } Else if (substr($path,-4,4) == ".txt") { //return same attrs for all 'txt' files
                        $st['mode'] = FUSE_S_IFREG | 0664;
                        $st['nlink'] = 1;
                        $st['size'] = 12;
                }
                return 0;
        }

        public function open ($path, $mode) {
                echo("open: $path");
                return 1;
        }

        public function read ($path, $fh, $offset, $buf_len, &$buf) {
                echo("read: $path");
                $buf = "hello world \n";
                return strlen ($buf);
        }

        public function release ($path, $fh) {
                echo("release: $path");
                return 0;
        }
}

$fuse = new FuseTest();
$fuse->mount("/mnt", "fsname=fusetest,debug,allow_other");

3). Now run with ./fusetest and use regular commands like “ls -l /mnt/” or “cat /mnt/test.txt” to see your data. The default for $fuse-mount() is to fork, and thread, hence the “debug” option being passed to the mount. If you don’t add the “debug” option you will never see what happens in your code, and all logging will just disappear. Of course, this may be what you want.

4.) Profit.



 

 Useful objdump args

May 8, 2012

I can never recall, or easily find the “best” set of args to use with objdump to disassemble a file usefully, so this serves as a reminder


objdump -M intel -Dslxwg /bin/foo

“-M intel” gives a sane disassembly instead of AT&T mnemonics, which should be the default really.
“-Dslxwg” gives, disassemble-all, full contents, with line numbers and all headers, wide format and includes debuginfo if available




Semi-organized

Business
Debian
Game Development
Hardware
Internet
Music
Reality Reversing
Reverse Engineering
Uncategorized
Unix Development