Tag Archives: tips

Moved to my new blog

I’ve been planning this for a while. I had written my own blog engine, it’s been bits and pices of code I’ve been patching to each other with band aid and chewing gum…

It was good for late 90s and early 2000… However the net changed, I had to move on, I didn’t update my blog code accordingly, it became sluggish, I became sluggish… No updates on my blog, no updates on my code… So I made one last leap and wrote a small perl script to port my contents to wordpress. It went OK. The content was there, well, at least the text part of it.

The images were another story. I was too lazy to write regexps to cover all my possible images in the content while importing. So I used some mod_rewrite tricks. I think it covered most of my image content.

I preserved the same story ids while importing, this gave me a lot of flexibility on the content that are “famous” on my blog: Like this one, and this one. They were contents that were constantly searched and linked. I couldn’t afford to lose them. So some more mod_rewrite magic needed. Like converting links like http://emresaglam.com/blog/haber.php?id=183 to http://emresaglam.com/blog/183

In the end, I spent almost equal time writing my perl script and my mod_rewrite rules 🙂 (for mod_rewrite: 3 lines to cover RSS, 5 lines to cover image contents plus friendly urls and backward compatibility) I’ll share them sometime when I’m not lazy.

Well, hopefully I’ll go back writing stuff again 🙂

İngilizce windows’da türkçe harfler.

Eğer siz de benim gibi ailenize Amerika`dan ucuz laptoplar getirip ingilizce windows kullanmak zorunda kalıyorsanız, türkçe harfleri bazı durumlarda görüntülemeniz zor olabilir. Bu durumlar için çok basit bir çözüm var.

Start -> Control Panel -> Regional and Language Options seçeneğine gidin. Açılan pencerede Advanced sekmesine klikleyin. Language for non Unicode programs kısmında ise Turkish seçin. Aşağıdaki ekran görüntüsünde olduğu gibi yani. 🙂

Windows Language settings

python and resolving ips from a csv file.

Problem: I have a CSV file where I have source and destination IPs. I want to resolve only destination IPs.

Format of my CSV file: (let`s call it test.csv) (it`s tab separated…) 118340.86 187

The solution is pretty simple with python:

#!/usr/bin/env python
import csv
import socket

reader = csv.reader(open(“./test.csv”, “rb”), delimiter=” “)
for row in reader:
host, aliases, ips = socket.gethostbyaddr(row[1])
print row[0] + ” ” + host + ” ” + row[2] + ” ” + row[3]

First we import the necessary libs. (socket and csv)

Then we open the file to read with as a csv object. (Careful because our delimiter is not comma, but TAB)

for each row we get the second row (row[1]), convert it to host, alias and ip by gethostbyaddr method.

The last line is to create the new tab separated format. (Just pipe it to a file and you have your new CSV file. [tab separated… but oh well..])


How to clean the activexdebugger32.exe virus

From Emre virus labs:

This motherfucker virus was living in my parents` computers. (Since I use Linux I don`t have any as usual…) And it`s a pain in the ass…

What the virus does:

  • Shares your drives to the world as PATRON1, PATRON2, etc…
  • Copies itself to any writeable devices around you. USB sticks are great examples.
  • On a USB drive, it generates an autorun.inf file and a copy of itself. Each time you connect your USB drive it infects your computer again…
  • It uses the CPU at least to 70%… Noisy bitch…

How do you know that you are infected:

  • Press CTRL+Shift+Esc buttons. You`ll see the activexdebugger32.exe process running.
  • You can see a copy of the executable (activexdebugger32.exe) in your USB drives if you enabled the STUPID Windows to show you hidden files.

How to kill the bastard and have a nice smiley day/night (It`s 3am ok?) If you kill your computer i`m not responsible.

  • Plugin your USB stick (if you have one)
  • Kill the process activexdebugger32.exe
  • Delete the activexdebugger32.exe binary. It usually lives under c:windowssystem32 (or c:winntsystem32 depending your Windows installation)
  • open regedit. Go to the top of the tree on the left pane. hit F3 (or CTRL+L) to open the search dialog. type, yes you know it, activexdebugger32.exe, NUKE the damn registry entries wherever it`s found. (Search until the end)
  • Go to the root folder of your USB stick and delete, yes you`re right again, activexdebugger32.exe and autorun.inf
  • Update: Motherfucker leaves more trails… Delete the file NESNELER.EXE (meaning objects.exe in turkish) under c:Documents and SettingsLocal SettingsTemp
  • Update: Delete all the files under C:windowssystem32 named: Ijl11.dll, KMON.OCX, KTKBDHK3.DLL, MSWINSCK.OCX, PAC, scrrntr.dll, scrrun.dll
  • Done.

Lastly, fuck microsoft and windows, have a nice life….

Update after 4 months: Damn I was angry when I wrote this. And it was 3 am. The entry was somewhat full of typos so i edited and changed some info. 😛