software

GRP packer plugin

The .grp (group) file format, used by the game Duke Nukem 3D, is just a collection of a lot of files stored into 1 big one. The Build engine, upon which Duke Nukem 3D was constructed, went on to become one of the most successful engine in terms of number of games released. Other notable games developed using the Build engine include Witchaven, TekWar, Shadow Warrior, Blood, PowerSlave and Redneck Rampage (check for a more complete list and more stuff about the Build engine at http://www.icculus.org/BUILD/). Thus, all of them use the GRP file format Smiling
So, here is the plugin I wrote for the Total Commander (TC for short) to access .grp files directly. It is able to list, unpack & pack GRP files (file deletion is unsupported by the format itself...). By the way, this TC plugin is the first one (and probably the only one ever Smiling) to be written in the pure assembler language. I suppose that it's also the smallest TC plugin, with it's 5.5 KB size! And here's a screenshot showing it in action (opening the DUKE3D.GRP).

Installation:

The same as for most TC packer  plugins:
  1. Unzip the grp.wcx to the TC directory (usually C:\totalcmd)
  2. Choose 'Configuration - Options'
  3. Open the 'Packer' page
  4. Click 'Configure packer extension DLLs'
  5. type grp as the extension
  6. Click 'new type', and select the "grp.wcx"
  7. Click OK

stas's picture
stas » May 6, 2006 » 00:19

I.E. 'hidden image' maker

sample masked image

If you are using Internet Explorer (any version able to load this page Smiling, just select the above image (or go to "Edit => Select All", or press Ctrl-A). You may see a watermark with white letters forming a word "TEST". This only happens in IE, due to the specific way it masks the selected images to show their selected state. Firefox, for example, simply tints the image with bluish color. There are lots of jokes one can make using this simple principle. For example, all images on your homepage may have some "subliminal" messages. Adobe PhotoShop is perfectly suitable to make such 'Hidden Images' by hand; in fact, my inspiration was a tutorial made by Matt Kment to do this. But if you are too lazy and/or do not have PhotoShop installed (UN*X users, for example), you can use this small program I wrote in Perl to automate the "steganographic" process. I wrote it using ImageMagickTM library (so it's required to successfully run the program). It is a command line program, but it is simple enough to use, and it has an advantage to be integrable into your own scripts/programs (you can even setup your server to embed your company logo into all graphics of your site, but this will overload the server's CPU and RAM too quickly). I called my program "Internet Explorer Mask'O'Matic". Take a look at it's startup screen:
Internet Explorer Mask'O'Matic v1.0 by Stas 
Grab yours at http://sysdlabs.hypermart.net/ Eye-wink

Inspirated by some mad stuff by Lem0nHead
Based on Photoshop 'Hidden Image' Guide (http://www.atomicwienerdog.com/ot/)
made by Matt Kment & suggested to me by xfalmp


ERROR: please give us --visible


* Usage: MaskOMatic.pl
* Options (note that you can use syntaxes like --vis= --hid -out -p):
--visible filename of image normally seen (required)
--hidden filename of image seen when selected in IE (required)
--output filename to write out, format is selected automatically
using suffix provided (required)
--percentage float value between 0 & 100; how much of hidden appears
(optional, defaults to 50%)
--quality JPEG/MIFF/PNG compression level (optional, DON'T USE!)
--contrast flag, internal contrast reduction (optional)
--test filename to dump preview of selected image (optional)

* Notes:
# Visible & hidden images doesn't need to have same size, when size
doesn't matches then hidden image is rescaled using Lanczos filter
# A huge set of image formats is supported (JPG, GIF, PNG for example)
but I strongly advice you to write output in loseless format *only*
(BMP, PNG, TGA) and *then* fine-tune contrast/brightness & save
compressed in your favourite image editor (like GIMP)

* Example:
MaskOMatic.pl --vis bush.jpg --hid death.jpg --out sublim.bmp
Only 3 options are obligatory: --visible, --hidden & --output. You can abbreviate them as -v, -h & -o, respectively. "Visible" is an image that user sees by default. "Hidden" is what user sees when he/she selects the image. And "output" is the resulting image you can embed into your pages. It is also possible to use the "--test" option to preview the selected state of the output image without starting Internet Explorer. If it looks bad, you may play around with "--percentage" option, which specifies the 'weight' of the hidden image. The higher is this value, the greater is the hidden image visibility. If that's not enough to hide your image well (some things are pretty difficult to hide!), you can try to tune the output image with "--contrast" option, but I suggest you to use some GUI program to do that as you get the visual feedback instantly. I also suggest you to always save your output in the non-compressed lossless format (like BMP, TGA, TIFF), and then fine-tune the compression in some program specialized in it (GIMP has a nice compressor with visual feedback).

Alternatives:

stas's picture
stas » May 5, 2006 » 17:47

"ps auwx" faker

"Process Stack Faker" (psf for short) is able to hide the real executable name and it's parameters from the output of "ps auwx", "ps -ef" & "top" (on UN*X machines), without any superuser privileges. Why should one wish to hide the stuff he/she executes is a complete different topic Smiling
Let's take a look at the options that psf itself accepts:

$ ./psf
Process Stack Faker (a.k.a. Fucker) v0.03
Coded by Stas; (C)opyLeft by SysD Destructive Labs, 1997-2003

Usage: psf [options] command arg1 arg2 ...
Where options can be:
-s string fake process name
-p filename file to write PID of spawned process - optional
-d try to start as daemon (in background, no tty) - optional
-l DO NOT exec through link (detectable by 'top'!!!) - optional
-u uid[:gid] (format just like in chown(1)) reset UID/GID - optional
-n priority renice process - optional

Example: psf -s "pine -i" -d -n 19 ./john -session:websrv
$
I hope this is self-explanatory. psf will execute "command arg1 arg2", and it will appear to "ps" & "top" utilities as "string". All other options are... Uhm, optional! They are only useful to detach processes not designed to run as daemons. "-l" is a 'compatibility' switch that disables the weird trick used to override the detection of the real filename by some process listers (notably "top"). The default option may work unexpectingly on some systems (by the way, psf works fine on FreeBSD 4.3, Linux 2.4, NetBSD 1.5 & Solaris 2.7). To test psf, try this:
$ psf -s "pine -i" sleep 30 &
[1] 440
$ ps auwx
...
stas 84 0.0 0.6 2012 1232 pts/0 S 19:12 0:00 bash -rcfile .bashrc
stas 440 0.0 0.1 1204 376 tty2 S 20:09 0:00 pine -i

stas 450 0.0 0.4 2544 816 tty2 R 20:12 0:00 ps auwx
...
"sleep 30" process was spoofed as "pine -i". Please note the white line between PIDs 440 and 450. This occurs because psf uses whitespace (0x20) characters to shift the original process arguments away from the visible area Smiling
To understand how does psf works and learn how to compile it, just read the comments inside the source.

stas's picture
stas » May 5, 2006 » 01:57

Micro$oft Messenger Hack


Micro$oft Messenger Hack screenshot

"Micro$oft Messenger Hack" (MSMH for short Smiling is a GUI alternative to the command line "net send", with some nice additional features. Please remember that "Messenger" referred here is a Windows NT/2k/XP system service, that "Transmits net send and Alerter service messages between clients and servers. This service is not related to Windows Messenger.". Messages transferred using this service looks just like this one:

"net send usage" screenshot

MSMH is able to send the same message as above example. It lists machines on the local network, so you won't mistype host names anymore. It can send messages multiple times, also (just imagine yourself flooding "*" Eye-wink. And, using "WinPopup" method, both "From" and "To" fields can be spoofed. By the other side, "net send" method can send messages beyond your LAN, given the IP address of the remote host.
MSMH executable is very small, as I programmed it in assembler language. But beware: Service Packs make the Messenger service disabled by default, and firewalls won't allow remote host to receive your messages. Well, MSMH was much funnier when I wrote it a long time ago Eye-wink

stas's picture
stas » May 5, 2006 » 01:53

ttysnoop for kernel 2.6

This project was made by a friend of mine, Vinicius Anselmo. He discontinued it's development (as it showed to be incompatible with later Linux kernels), so I proposed to host his work on my site.

ttysnoop is a small program made by Carl Declerck that allows an administrator to snoop on login terminal through another. It worked until kernel 2.4 because they still with BSD-style pty's support. Here it is a solution for 2.6.

Screenshot:

ttysnoop usage screenshot

SSH:

Is ttysnoop compatible with sshd? ttysnoop was created to work with inetd, however, there is a way to make it work with sshd.
First you will need the source code of the sshd. Edit the file configure and add these lines:
LOGIN_PROGRAM="/sbin/ttysnoops"
export LOGIN_PROGRAM
Now it is necessary to verify the paths, so that the new executable uses the same configuration files of your system. For my system I solved making this modification in pathnames.h:
// #ifndef SSHDIR
#define SSHDIR ETCDIR "/ssh"
// #endif
And executing the script configure specifying a null prefix:
./configure --prefix=
Now compile the program. Make a backup copy of your /usr/sbin/sshd and put your new sshd in the place. That should work. If you are using RedHat or Fedora Core you can try to use my executable (see below).

Bugs:

After log out, it doesn't remove the pseudo-terminal entry. Meaning people showed up as still logged in when they weren't.
I use: who -u | grep -v ?
to see who really is on my system. I don't know how to solve it.

stas's picture
stas » May 4, 2006 » 13:09

ToFroWin CR/LF converter

ToFroWin adds the following context menu into Windows Explorer (accessible with right mouse button click over file name):

ToFroWin context menu

It simply converts between the text line endings of UN*X (CR or "\n") and DOS (CRLF or "\r\n") systems. Actually this is a Win32 GUI port of Tofrodos Ver 1.7 by Christopher Heng. ToFroWin is also able to convert files in batch: just select multiple files and convert them with one click. Beware to not corrupt binary files!

Installation:
ToFroWin is too small and too simple to make a self-installation for it. It can be easily installed "by hand".
Extract archive to any directory ("C:\Program Files\"). Then go to this directory and execute "install.bat". To uninstall execute "uninstall.bat" and then simply delete ToFroWin files.

Installation on Vista:
Symptoms: during the install/registering the DLL, RegSvr32 pops up an error:
The module "ToFroWin.dll" was loaded but the call to Dll RegisterServer
failed with error code 0x80070005. For more information about this problem,
search online using the error code as a search term.
Or, running as Administrator:
The module "ToFroWin.dll" failed to load. Make sure the binary is stored
at the specified path or debug it to check for problems with the binary
or dependent .DLL files.  The specified module could not be found.
Solution: go to Start, Programs, Accessories, right-click on Command Prompt, run as Administrator, go to the folder you extracted ToFroWin to, and type "install".

Great thanks for Monk for discovering/fixing this Laughing out loud


Starting an internet business can turn to out to be very beneficial. Through a free software one can create the web design of the site. The domain web hosting can be bought for a very cheap rate. It would be advisable to use budget web hosting in the start though.

stas's picture
stas » May 4, 2006 » 13:04

rockin' PC speaker

Well, good old PC speaker is the only default hardware, easily available on almost all PC systems, and virtually unmuteable (actually, one can connect PC speaker output to his/her sound card instead of default buzzer, but this rarely happens Smiling. Thus, it is perfect for communicating critical states. But the default system beep is quite boring, and makes difficult to distinguish different events that are being communicated. So, here's my humble attempt to make a highly portable function that is able to play simple non-polyphonic music on the PC speaker. I used it originally to advise when someone tried to log in to my system through SSH daemon (thus the name "daemoniac" - demoniac Eye-wink. It was tested (and worked fine!) under:
  • DOS (DJGPP, Turbo C)
  • Windows 9x/NT/2K/XP (Borland C, Microsoft Visual C, MinGW)
  • Linux (gcc)
  • FreeBSD (gcc)
By default, demoniac will play Iron Maiden - Fear Of The Dark beginning. You can also compile it to play the simple "A#4 D#5 G5 A#5 G5 A#5" melody. Note that on UN*X systems, demoniac accesses hardware directly, and thus requires to run as root user. It's safe, through: it won't accept any command line arguments and neither process environment variables, so, at least, it can't be exploited with some buffer overflow technique. For detailed instructions about compiling demoniac on different compilers/systems, read the comments at the start of the source. Note that my package provides all the binaries generated on compilers/systems listed above.

stas's picture
stas » April 20, 2006 » 02:06

ASCII code explorer

Designed to be the freakin' best ASCII table viewer for DOS platform, LOL!!!

ASC.EXE screenshot

It accesses the console font bitmaps directly from the BIOS and amplifies them 16 times (bitmaps in a hex form are shown, also). User can navigate the character map using his/her mouse or the cursor keys.  For every character, it's ASCII code in decimal, hexadecimal & binary formats is displayed. One can also build strings of ASCII characters, just like in Windows' "Character Map". Foreground/background colors for the character, magnified character & character string are also editable through the GUI (there are 16 colors available for background, instead of default 8 Smiling. It's pretty useless today, but helped me a lot to develop my elder programs. By the way, this ASCII explorer was written using QBasic 4.5...

stas's picture
stas » April 20, 2006 » 01:52

GibCounter QW stats

GibCounter is a tiny yet quite useful game statistics generator for QuakeWorld games. It operates parsing frag*.log files generated by the QuakeWorld game server. If your server doesn't generate such a log files by default, you may enable this feature executing the server as follows:
qw-server +set fraglogfile 1
Of course you can also edit your server's .cfg files to enable frag logging. You may run GibCounter on the same machine (and, on UN*X systems, as the same user) that runs the game server. If it's a QuakeForge server, then GibCounter will locate log files automatically at the path $HOME/.quakeforge/qw. For the different ports of the QuakeWorld server, or a QuakeForge server operating as a different user, you may specify the location of the qw directory manually. To do that, simply pass the new directory as an argument to GibCounter (using your favorite command line shell):
perl gibcounter.pl /home/qserver/.quake/qw
GibCounter outputs the generated HTML code directly to STDOUT. So, if you're going to add it into your server's crontab, don't forget to pipe the output to some file! For example, the following crontab line will regenerate GibCounter game stats every 30 min and make it available through the URL http://yourserver.com/~youruser/gibcounter.html (file paths & crontab format may be different on your system; so ask your system administrator if unsure):
0,30 * * * * perl $HOME/gibcounter.pl > $HOME/www/gibcounter.html
GibCounter is also highly theme-able: CSS style of almost every element may be changed within gibcounter.css file. Of course, you can also edit the HTML template which is contained inside the Perl source itself Smiling
The game statistics page generated by GibCounter is self-explanatory. On the top, it will show players ranking, sorted by (guess what?!) the frags they scored. Frags are computed as: kills minus suicides. GibCounter also computes how many times each player was killed by others. And, on the bottom of the generated page, some computed totals are shown. This includes the period of time for which the stats were made, the top fragger (the best) & the top fragged (the worst) players. Please note that players with default nicknames, such as "unnamed" or "user-#", are automatically excluded from being processed, simply to avoid useless information bloat (as many different players would be rated as one, with very high kill/death number)!
By the way, GibCounter preserves the colorization of the graphical font in players' nicknames (Quake console is able to print some ASCII characters in white, orange, gold & brown colors), and translates all symbols into readable ASCII.
So, after all, how does GibCounter-generated page looks like?! Look for yourself, here are some example stats. Also, feel free to modify the program itself to fit your own needs!

stas's picture
stas » April 20, 2006 » 01:48

ptBR nums2words()

Uma função que programei para retornar strings com números escritos por extenso. Por exemplo: nums2words(2006) retorna "dois mil e seis".
Não que não exista mais nenhum algoritmo para isso; acontece que quis criar o meu próprio de tal forma que ele seja de fácil implementação em C, e que seja portável para outras linguagens, no sentido mais extenso (tanto linguagens computacionais, como Perl, Java, PHP; como linguagens humanas, como inglês, espanhol, russo).
Funciona da seguinte maneira: os números são "decompostos" em sub-unidades maiores possíveis às quais nós, humanos, damos nomes. No exemplo do 2006, há 2 unidades: "dois mil" e "seis". Essa operação é feita através do velho e bom resto da divisão, sem ter que converter o número em string e processá-la dígito por dígito.
Na realidade, comecei programando-o em Perl, depois traduzi para C, refinei, otimizei, aí traduzi de volta para o Perl Smiling
Não sei se está gramaticalmente correto; porém está perfeitamente compreensível. Acredito que o mesmo algoritmo poderá ser reaproveitado para inglês e russo. Porém isso fica a cargo do leitor!

stas's picture
stas » April 20, 2006 » 01:37
XML feed