May 2009
The Archives
-
05.26.09Auditing ports (FreeBSD)One of the most important aspects of *BSD systems is security. Knowing which installed packages have exploitable vulnerabilities is one of the admin's tasks. Here, the portaudit utility comes in handy. It is not part of the base system, so it must be installed first: % cd /usr/ports/ports-mgmt/portaudit; make install clean To run a simple check: % portaudit Affected package: XXX Type of problem: XXX -- embedded GD library Use-After-Free vulnerability. Reference: <http://www.FreeBSD.org/ports/portaudit/6XXxf31-4254-11de-bXX-0030843d3802.html> Affected package: YYY-0.2.8.4_2 Type of problem: YYY -- integer overflow vulnerability. Reference: <http://www.FreeBSD.org/ports/portaudit/48aab1d0-YYY-YYYYYYY-0030843d3802.html> Affected package: ZZZ-1.10.2_2 Type of problem: ZZZ -- integer overflow. Reference: <http://www.FreeBSD.org/ports/portaudit/4b17ZZZZZZbecb-001cc0377035.html> I have omitted the details of the vulnerable packages of my own machine. I'm sure you ...
-
05.18.09Vi: emptying a file in one shot:1,$d This vi command blanks out the file being edited. Updated: javisantana suggested another way to emptying a file. Type: ggdG in command mode.
-
05.16.09Systatsystat is a base system utility that displays system statistics. Information is updated automatically and shown in a pseudo-graphical way (based on ncurses). $ systat /0 /1 /2 /3 /4 /5 /6 /7 /8 /9 /10 Load Average || ...
-
05.14.09Split a fileSometimes you need split a file. For example, to send them attached to an email. For this, you can use the split command. $ split -b 1m big_file file_part_ In the example, the big_file size is 10MB, the -b option split the file in 1MB pieces, and the file_part_ is the name given to the different parts. $ ls file_part_* file_part_aa file_part_ac file_part_ae file_part_ag file_part_ai file_part_ab file_part_ad file_part_af file_part_ah file_part_aj All the files are 1MB long. For joining all the parts you can ...
-
05.12.09Quick access to the ASCII tableman ascii Prints octal, hexadecimal and decimal listings of the ASCII character set.
-
05.10.09Get someone to make you a sandwich$ sudo make me a sandwich From the great xkcd webcomic :)
-
05.08.09Creating a file with a specific sizeThe last week I had to test the transfer speed between two machines. I tested it sending files with different size. For creating those files I used the dd command which allows to create an empty file of desired size. $ dd if=/dev/zero of=file_to_create bs=1k count=1024 1024+0 records in 1024+0 records out 1048576 bytes transferred in 0.010811 secs (96992910 bytes/sec) /dev/zero is a special file that provides as many null characters (ASCII NUL, 0x00) as are read from it. In the above example, the bs option set both input and output block size to 1k, and the count option copy only 1024 input blocks, so ...
-
05.06.09Vim, a short tutorialSince quite a while, I have intended to write a short Vim tutorial. I do not plan it to be a very detailed guide, I just want to show some of the features of Vim I use often. In this first chapter I explain what Vim is and what it can do for you. Vim is a command-line oriented editor. This is true even though there are some gui-oriented, vim-based alternatives (gvim, for instance). It is based on the ancient Vi, but Vim stands for Vi (i)Mproved, as it provides more powerful features. Some of the things which can be done ...
-
05.04.09ASCII Star Wars via telnetIt is old but the ASCII version of Start Wars via telnet is absolutly awesome. $ telnet towel.blinkenlights.nl
-
05.02.09Saving bash linesThanks to the short-circuit behaviour of the && operator, if-statements can be replaced by: [[ test ]] && if_true_do_this || otherwise_do_that So, instead of writing: if [[ "$1" == "$2" ]]; then echo "$1 equals $2" else echo "$1 differs from $2" fi One can write: [[ "$1" == "$2" ]] && echo "$1 equals $2" || echo "$1 differs from $2" Braces can be used to run more than a single command: [[ test_condition ]] && { true_stuff_1; true_stuff_2; } || { false_stuff_1; false_stuff_2; } Via | commandlinefu