Log in

No account? Create an account

Tue, Jan. 25th, 2011, 02:29 pm
Bypassing pulseaudio per application

This only works for applications which use alsa.

1) Make sure your user is in the audio group.

2) Create a .asoundrc (or asound.conf in etc if you want)

pcm.!default {
    @func refer
    name { @func concat 
           strings [ "pcm."
                     { @func getenv
                       vars [ ALSA_DEFAULT_PCM ]
                       default "pulse"

ctl.!default {
    @func refer
    name { @func concat 
           strings [ "ctl."
                     { @func getenv
                       vars [ ALSA_DEFAULT_CTL
                       default "pulse"

pcm.pulse { type pulse }
ctl.pulse { type pulse }
pcm.0 { type hw card 0 }
ctl.0 { type hw card 0 }

3) Launch the application from a terminal as follows:

$ pasuspender -- dosbox

Example is for launching dosbox with direct sound card access.

Thu, Oct. 15th, 2009, 02:08 pm

Dear Livejournal Users,

    this place is all but dead these days, whilst I'm not a very active blogger, I do like to post stuff every once in awhile, either about my life, or about technical stuff.

What should I do?

P.S. I quit started quit smoking again.

P.P.S. Why is Facebook such a festering pool of love? I mean seriously no one ever says anything nasty on there. It's not that I enjoy people being nasty, more like I start to doubt peoples sincerity when they never say anything controversial.

P.P.P.S. Why the hell do they call it "friend", half the people on my Facebook friends list would barely scrape "acquaintance".

P.P.P.P.S. I'm quite pissed off right now for reasons I don't really wish to share with the general population, (you can probably tell from my rant, or maybe that's normal for me, I dunno).

Tue, Apr. 28th, 2009, 12:41 pm
Swine Flu

Just a reminder than flu is endemic amongst birds, humans, pigs, and possibly other species. It's also interesting that the 1918 flu pandemic occured in 3 waves, each more deadly than the next, whilst it's not known if people infected in the first wave were immune to the second and third waves it is known that those infected by the second wave were immune to the third wave. The third wave was by far the most deadly.

Also flu is sometimes asymptomatic, which makes it extremely hard to isolate infected people.

Whilst medicine may have advanced, the amount of international travel has increased massively. If there was enough travel in 1918 for the flu to be a worldwide pandemic how can we possibly hope to contain it when there are already suspected cases on 4 continents. Another interesting point is that because the virus is likely to be so wide spread, it makes mutations which will make the flu more virulent extremely likely.

It's also interesting to note that the current prevalent human strain of flu is mostly resistant to Tammiflu, it is perhaps more responsible of health agencies to use anti-viral drugs only in the most dire of cases, rather than dishing them out like candies.

On the brighter side, those infected in this wave of flu infections will most likely be immune to the next wave, and in 6 months time there should be a flu vaccine which includes swine flu (assuming the virus does not mutate into a form which the vaccine does not confer immunity to, which is quite likely if there is a mass vaccination program). If a mass vaccination program creates a new strain of the virus then those who suffered the first wave of the current epidemic will likely not be immune to the second wave.

The thing I love about nature is our pathetic attempts to meddle with it are often counter productive.

Mon, Mar. 9th, 2009, 07:46 am

It's my personal opinion that copyrights and/or patents do not have a place (at least in their current form) in a 21st century world, but I won't go into that.

Recently I've seen digitized historic works start appearing on the Internet, which is a great thing, but not when you slap your own copyright on it. Digitising it does not make it a derived work any more than reprinting it does.

For example if I digitise a Tom Lehrer video (there are some great examples on youtube, which I would encourage people to watch), it does not magically become © 2009, the year of the copyright is fixed at the year it was first published unless significant modifications are made (this is why most software is © 2000x-2000x, but lets leave software out of this). The term of copyright varies massively between countries and it is often difficult to determine which country's copyright laws apply, unfortunately the international efforts to harmonise copyrights are leaning towards longer and longer periods.

This is why extremely old publications like the Bible, works of Shakespeare cannot be copyrighted without significant modifications (contrary to what some publishers seem to think), in any case if it is more than 70 years since the death of the author and more than 95 years since the original publication of the work you can be fairly sure that the work has entered the public domain in most western countries.

In my opinion harmonising the copyright term at 50 years from publication for all copyrightable material would not be a bad thing as the term of copyrights vary wildly depending on the host country. I would prefer until the death of the author, however this is overly complicated to apply to collaborative works. There are several cases where copyrighted items have become public domain, and then reverted back to copyright due to changes in the law in one or more country.

I'm all for protecting the rights of people who create artistic works, but honestly can anyone think of a good reason why this period should be for more than 50 years from publication?

My legal opinions are probably not worth the pixels they are written on, so if you get sued for all your money don't come crying to me.

© 2009 Cyberian Tiger.

Wed, Feb. 11th, 2009, 12:23 pm
A 32 bit operating system can only use 4GB of memory.

It's basically a lie.

Most windows versions are artificially knobbled to exactly 4GB total memory with the exception of server 2003 (enterprise and database) which grok 64GB and 128GB of RAM respectively. Vista 32 bit is also knobbled to 4GB.

Windows XP erroneously reports 4GB minus the memory allocated to DMA buffers for drivers, even though it can use the full 4GB.

Linux, Mac OS, *BSD all grok PAE and can use up to 64GB of memory.

All 32 bit operating systems are limited to 2-3GB of user space memory per process depending on configuration.

All the modern operating systems use page tables, this is why operating systems which understand PAE can access 64GB of RAM. Imagine all the RAM in your computer split up into small blocks, when a process accesses a memory address, it uses the page table to find the block of physical RAM which contains the data. This allows any portion of the 64GB to be mapped into the 4GB of addressable memory.

So while there is up to 3GB per process, there are certain structures which must be in addressable memory at all time, this includes the kernel, various memory holes for communicating with devices and god knows what else. (Technically the kernel does not need to be in addressable memory all the time, but changing the page table incurs a performance hit, so typically for performance reasons it is).

When the kernel switches the current process(es) it changes the page table, this is why you can still use the whole 64GB even though there is only up to 3GB per process.

Thu, Jan. 15th, 2009, 02:29 pm
The Perfect Storm

If I were to design a perfect botnet, I would use the following technologies.
  • Listen on udp:53

    There are two options for the protocols you use, http or something which looks like dns, as these are the two most common protocols on the internet, and you want your traffic to look 'normal', fastflux hosting could also be run on this port, and you could use TXT or some of the DNS sec extensions for inter-bot communication.

  • Peer to peer nature similar to existing botnets

    If you have a central point of control such as an IRC server then you will fail, modern botnets must be peer to peer.

  • UDP port tunnelling similar to skype

    This is used for communicating between bots, most home computers these days are not directly connected to the internet, and are hidden behind a NAT firewall. Skype's port tunnelling (they patented it I believe, bastards, someone find some prior art, because I thought it was obvious) allows you to make peer to peer connections between two NATed hosts.

  • Control messages must be digitally signed

    This one is obvious, if someone reverse engineers your bot, then they can write their own botnet client and connect to your botnet and send their own control messages. This is defeated by simply digitally signing all your command messages (which can be forwarded over the botnet with the signature entact and verified by each node in the botnet).

  • Encryption

    This doesn't have to be industrial grade stuff because it will be cracked whenever someone reverses your botnet code, it is just there to obfuscate things.

  • Replay protection

    It's no good digitally signing control messages if someone else can resend any command you have sent when they choose (for example the command to stop doing a DDOS attack against a target), this can be achieved by simply adding a sequential number to each command, if a command is received who's sequential number is not higher than the previous command then it is ignored. (There are some race conditions associated with this, but they can be avoided by not sending commands faster than one per minute or so).

I should probably make this private, but to be honest it's not rocket science and I'm only stating the obvious.

Fri, Dec. 19th, 2008, 03:21 am
Linux on a USB stick.

For awhile I've been wanting to put Linux on a USB stick, unfortunately all the guides I found on the internet assume you're using that other proprietary OS that we don't speak about.

No penguins were harmed during the making of this guide, there is no requirement to burn any CDROMs, all you need is a working Linux box with standard tools and an internet connection.

This guide makes a persistent install which can be used with a single PC (It will probably work on multiple PCs, but that's more by luck than design). If you want a bootable and portable USB stick you may find one of the boot-a-live-cd-from-a-usb-stick guides more use.

  • Download hd-media/boot.img.gz from the Debian version of your choice. e.g. http://ftp.debian.org/debian/dists/testing/main/installer-i386/current/images/hd-media/boot.img.gz
  • Download the .iso image you want to install from. e.g. http://cdimage.debian.org/cdimage/lenny_di_rc1/i386/iso-cd/debian-testing-i386-netinst.iso
  • $ gzip -d boot.img.gz
  • $ mount -o loop boot.img /mnt/loop
  • $ cp install.iso /mnt/loop
  • $ umount /mnt/loop
  • Optional boot.img is a FAT16 image, you can at this point resize it, if you want your installation partition to be a different size (the default at the time of writing was 220Mb, which should be fine for most people). For example:

    $ fatresize -v -s 40M boot.img && dd if=boot.img of=boot2.img bs=1M count=40
  • Repartition your target media, delete all partitions and create a new primary fat16 partition and make it bootable, make it's size equal or larger than the size of boot.img
  • Optional Install an mbr on the medium using
    $ lilo -M /dev/sdX
  • Copy the bootable image to the partition you created.
    $ cat boot.img > /dev/sdX1
At this point you should have a bootable medium which drops you into the debian installer. On the device you wish to use the medium with, boot the medium and go through the installer as normal with the following caveats.
  • Install debian into the free space on the medium.
  • If the medium is a flash device you may wish to use ext2 instead of ext3 as journalling file systems combined with flash are considered by some people to be bad. For the same reason you may want to avoid usinga swap partition.
  • When you get to installing the bootloader, I strongly suggest you install it into your root partition, not over the top of the mbr. For example /dev/sdX2.
  • If there is more than one medium in the device be aware that the BIOS will probably remap your medium to hd0 when booting from it, which will probably not be the same device that the installer configured grub to use, you will need to fix it.
  • The installer can still be reached by using the chainloader syntax in grub.conf and booting (hd0,0), just like you would boot windows from a separate partition.
  • You may want to remove the installation partition and resize your ext2 partition to take the whole device, but I'm leaving that as an exercise for the reader. My personal choice would be to lose 220Mb to the installer, it might come in useful.

Tue, Dec. 9th, 2008, 03:00 pm

I'm alive, it is trying to snowing, nearly everything is good.

Currently my sleeping pattern is screwed up and looks like this:

midnight-1am: go to sleep
4am-5am: wake up
6am-8am: go back to sleep
12pm-2pm: wake up again

This is the second time I've fallen into this pattern and it is a pain to get out of, last time it took me 2 weeks to get back to a normal sleeping pattern. I work evenings and there is no daylight in Finland (except after it snows).

Tue, Nov. 25th, 2008, 10:16 am
Assign yourself multiple static IP addresses

Want to know how to get multiple public static IP addresses via DHCP?

You need:

1) An internet connection which is configured via DHCP.
2) A linux machine connected directly (not via a NAT box).

What's that? DHCP assigned addresses aren't static unless you pay for them you say?

If you configure your linux box to use dhcpcd (on ubuntu just uninstall all the other crap dhcp clients), then invoke it with a -s "$IP", it will request that IP address, and you will get it if it is currently available, it is best to run DHCP normally once, and then from that point on tell your dhcp client to request the first IP address you were assigned.

In Ubuntu this can be done by editing /etc/default/dhcpcd, and adding the following lines in the right place:


Where eth1 is the interface you're want to use the address on.

Ok, so the next question, you only have one interface connected to the internet, how do you run two different DHCP clients on it?

You don't, you make another interface using the following ip voodoo:

# ip link add link eth1 eth2 type macvlan

This creates a new interface eth2 which uses the existing hard interface eth1.
The new interface can be removed with this voodoo:

# ip link del eth2

On ubuntu this can be achieved in a permanent fashion by editing /etc/network/interfaces and adding the following voodoo:

iface eth2 inet dhcp
        pre-up ip link add link eth1 eth2 type macvlan
        pre-up ifconfig eth2 hw ether 55:55:55:55:55:55
        post-down ip link del eth2

auto eth2

Notice the extra code to assign a mac address to the interface, if we do not do this then it receives a random mac address, which will cause our static IP address hack to fail.

Edit: It turns out you need to leave eth1 unconfigured and add multiple interfaces using macvlan otherwise the dhcpcd on eth2 confuses the dhcpcd on eth1, I've fixed the full configuration but not the rest of this post.

Full working configuration for ubuntuCollapse )

Thu, Aug. 28th, 2008, 10:16 am
Georgia / Russia

Everyone and his pet cat has an opinion about this, so I might as well wade in.

Let me say the vast majority of the western media seems to have deviated away from the facts by a long way. They still report the facts, but they seem to be spouting their own rather poorly informed views. Much as I hate wikipedia, any idiot can lookup South Ossetia or any of the other autonomous republics which Russia is bitching about, and the first noticable thing is that they all have claimed or at least tried to claim independence since around 1991, (Yes, that is when the USSR broke up). I find it hard to believe that Russia started infiltrating and subverting these republics at the same time as disbanding the USSR.

So, lets pretend to believe the Russian line that it's protecting Russian citizens and peacekeepers which were already present in both autonomous republics. Much as I dislike Russia this statement is entirely correct, and quite reasonable, the problem is the government in S. Ossetia has been giving out Russian passports to people from the area, and deliberately wound up Georgia into shooting at the peacekeepers. Essentially deliberately precipitating the whole crisis. The reason it seems is that South Ossetia has many connections with organised crime, gun running, even counterfitting US dollars.

Now I'm somewhat pained to believe that Russia is innocent in all this, so I don't, I believe that Russian Mafia government is just protecting it's trade routes with the west (lets face it nobody wants to deal directly with Russia these days). The shame is no one will ever manage to prove this one way or the other.

So, what can the west do to Russia for messing up "European" borders? No much except a sound verbal spanking, after all, we don't want to freeze in winter because we have no heating. Oh, the oil pipeline through Georgia? I very much doubt it was a Russian objective (unlike the oil wells in Iraq / NATO), though I'm sure they're happy that it put the price of oil up.

What happens next? Well, the west (especially NATO countries and those not reliant on Russian oil and gas) will continue to verbally spank Russia, but we will see no action from them, Russian peacekeepers will continue to control the autonomous provinces in Moldova, Georgia and arguably the Ukraine, as I very much doubt they want European peacekeepers patrolling their smuggling routes. Georgia and the Ukraine will continue to be *joining NATO for quite some time.

There's a very informative article here: Discussing the ‘Unplanned Ossetia War’ with Professor Schneider, also the wikipedia articles (and their references) on the various autonomous republics (Crimea, Transnistria, South Ossetia and Abkhazia).

* Lets face it we can't really allow countries into NATO who have internal conflicts which are policed by Russian peacekeepers, should those conflicts flare up again, NATO would be obliged to join in, which would be very bad for world peace.

10 most recent