Posts Tagged ‘bunch’

Adding custom user based host IP aliases load custom prepared /etc/hosts from non root user on Linux – Script to allow define IPs that doesn’t have DNS records to user preferred hostname

Wednesday, April 14th, 2021

adding-custom-user-based-host-aliases-etc-hosts-logo-linux

Say you have access to a remote Linux / UNIX / BSD server, i.e. a jump host and you have to remotely access via ssh a bunch of other servers
who have existing IP addresses but the DNS resolver recognized hostnames from /etc/resolv.conf are long and hard to remember by the jump host in /etc/resolv.conf and you do not have a way to include a new alias to /etc/hosts because you don't have superuser admin previleges on the hop station.
To make your life easier you would hence want to add a simplistic host alias to be able to easily do telnet, ssh, curl to some aliased name like s1, s2, s3 … etc.


The question comes then, how can you define the IPs to be resolvable by easily rememberable by using a custom User specific /etc/hosts like definition file? 

Expanding /etc/hosts predefined host resolvable records is pretty simple as most as most UNIX / Linux has the HOSTALIASES environment variable
Hostaliases uses the common technique for translating host names into IP addresses using either getaddrinfo(3) or the obsolete gethostbyname(3). As mentioned in hostname(7), you can set the HOSTALIASES environment variable to point to an alias file, and you've got per-user aliases

create ~/.hosts file

linux:~# vim ~/.hosts

with some content like:
 

g google.com
localhostg 127.0.0.1
s1 server-with-long-host1.fqdn-whatever.com 
s2 server5-with-long-host1.fqdn-whatever.com
s3 server18-with-long-host5.fqdn-whatever.com

linux:~# export HOSTALIASES=$PWD/.hosts

The caveat of hostaliases you should know is this will only works for resolvable IP hostnames.
So if you want to be able to access unresolvable hostnames.
You can use a normal alias for the hostname you want in ~/.bashrc with records like:

alias server-hostname="ssh username@10.10.10.18 -v -o stricthostkeychecking=no -o passwordauthentication=yes -o UserKnownHostsFile=/dev/null"
alias server-hostname1="ssh username@10.10.10.19 -v -o stricthostkeychecking=no -o passwordauthentication=yes -o UserKnownHostsFile=/dev/null"
alias server-hostname2="ssh username@10.10.10.20 -v -o stricthostkeychecking=no -o passwordauthentication=yes -o UserKnownHostsFile=/dev/null"

then to access server-hostname1 simply type it in terminal.

The more elegant solution is to use a bash script like below:

# include below code to your ~/.bashrc
function resolve {
        hostfile=~/.hosts
        if [[ -f “$hostfile” ]]; then
                for arg in $(seq 1 $#); do
                        if [[ “${!arg:0:1}” != “-” ]]; then
                                ip=$(sed -n -e "/^\s*\(\#.*\|\)$/d" -e "/\<${!arg}\>/{s;^\s*\(\S*\)\s*.*$;\1;p;q}" "$hostfile")
                                if [[ -n “$ip” ]]; then
                                        command "${FUNCNAME[1]}" "${@:1:$(($arg-1))}" "$ip" "${@:$(($arg+1)):$#}"
                                        return
                                fi
                        fi
                done
        fi
        command "${FUNCNAME[1]}" "$@"
}

function ping {
        resolve "$@"
}

function traceroute {
        resolve "$@"
}

function ssh {
        resolve "$@"
}

function telnet {
        resolve "$@"
}

function curl {
        resolve "$@"
}

function wget {
        resolve "$@"
}

 

Now after reloading bash login session $HOME/.bashrc with:

linux:~# source ~/.bashrc

ssh / curl / wget / telnet / traceroute and ping will be possible to the defined ~/.hosts IP addresses just like if it have been defined global wide on System in /etc/hosts.

Enjoy
 

GUI wep/wpa cracking through Gerix Wifi Cracker NG (GUI for cracking wireless networks)

Thursday, December 10th, 2009

gerix-wifi-cracker-hack-into-wireless

I found a neat program that facilitates work on cracking
a wep or wpa secured wireless network. The program is called
Gerix Wifi Cracker NG and is a part of the
backtrack penetration testinglinux distro
Gerix Wifi Cracker itself is located here , it's cool cause the author even has prepared a deb
package with the nifty GUI wireless cracker
. The slogan of the soft is also a killer,it reads:
"The software that even your grandmother knows how to use!",
a bunch of nice granda's pictures are included as well 🙂

GNU and Free Software founder Richard Stallman tries to peacefully protest European software Patents – Is european Union really democratic?

Friday, July 13th, 2012

rms-sign-peacefully-protests-anti-freedom-EU-legislation

Richard Stallman the main person thanks to whom the GNU (GNU is not UNIX) organization, free software as we know it and GNU / Linux free operating system exists has been notable for being a pain in the ass for politicians. RMS has dedicated his life for the only goal to propagate his ideas that all computer software should be free as in freedom. He is known to have engaged in various petitions and peaceful protest events as well doing his best to raise awareness in people that our Freedoms as we know it are large endangered due to a daily introduced laws throughout the world aiming to limit us and take away our constitutional (democratic) freedoms.

In his lectures RMS at many times puts his thoughts on the lack of real democratic decision taking in the European Union.

A good example on how un-democratic the EU is a Software Patent session being held in Brussels just a a year ago. The Software patent session is officially said to be opened, (so anyone from the public) can participate. What is really weird about the whole thing is that an European institution is trying to campaign a software patents to be legislated in Australia. Hmm isn't that weird, wasn't the European Union to be mainly engaged in minding for the European member countries and european economy or software situation. Why on earth they try to in-force software patents in Australia if Australia has nothing to do with the EU. Didn't the EU has enough problems already caused by patenting … The patent session held was completely "bribed" as Stallman points out, the people attending was "computer specialists" and patent experts who were all only  in favor of software patents and there was no practical representative of any tech-expert who was not in favour of software patents. Stallman tried to peacefully protest the unwalful meeting by just holding a big signature saying  "NO TO SOFTWARE PATENTS". He entered the hall and tried to stay in the back of the room with the NO SOFTWARE PATENTS slogan without even saying a word. A short after a policeman come and took him away for no apparent reason, obviously showing that peaceful protesting to any of what the EU is lobbying about is no longer possible. Now how this is a democracy and how comes the European Union is proclaiming being democratic if even a peaceful protesting of someone or bunch of people opposing an idea, agenda or meeting can't take place?

 

GNU founder tries to peacefully protest in European Patent session, being pushed away by police

Windows unable to delete file, file locked unlocking with Unlocker tiny tool

Wednesday, April 13th, 2016

Windows-Unlocker-program-show-what-program-or-software-is-locking-your-file-why-file-cant-be-deleted-file-locked

If you want to delete some file on a Windows server or Desktop but you get the a dialog with an error saying:

"This action can't be completed because the folder or a file in it is open in another program"

windows-unable-to-delete-file-file-locked-get-what-is-locking-it-and-unlock-the-file-with-Unlocker-tiny-desktop-graphic-tool-0

Then you need to find out which Program is preventing the file from deletion / locking the file, I've earlier blogged on how to check which process locks file with tasklist or wmic Windows commands

However some users might prefer to not bother with command line check what is locking a file and then killing the Process manually with taskmanager (taskmgr.exe) but do both file unlocking from one single gui interface, that's especially for lazy novice users, gamers and most of Desktop Windows users.

If you're one of those lazy users you will appriace

Unlocker – a useful utility for unlocking files, it will help you figure out which file is using a file what program is using the file you're prevented to delete.
Unlocker is the tool for you if you get any of below error messages, when you try to delete a file:

 

  • Cannot delete folder: It is being used by another person or program
  • Cannot delete file: Access is denied
  • There has been a sharing violation.
  • The source or destination file may be in use.
  • The file is in use by another program or user.
  • Make sure the disk is not full or write-protected and that the file is not currently in use.
     

windows-unable-to-delete-file-file-locked-get-what-is-locking-it-and-unlock-the-file-with-Unlocker-tiny-desktop-graphic-tool-1

If you stumble unto an locked file once you download and install Unlocker tool and launch the tool ( in case it disappers in future a mirror of Unlocker tool here ).
Once installed if you click properties over the file which is refused to be deleted you will get a new menu such as in below screenshot:

NB! Beware while installing Unlocker you might be offered to install a bunch of malware (make sure you deselect it). Also Unlocker's site is made in a way so the Download button could easily be confused with some Google Adsense

unlocker-windows-menu-added-to-properties-options-screenshot

Click on the file that is being locked and choose the Unlocker button, for example if you have a bunch of Videos installed and the video is being locked by VLC clicking on the file you will be shown VLC like in below screenshot

 

Unlocker-screenshot-locked-file-because-movie-opened-in-VLC

As you see you're shown the Process PID that is being used by the file the full path to the locking program and you have the option to quickly kill the process or unlock the file. Note that at some cases unlocking a file used by some critical program lets say Microsoft Word / Excel or OneNote could cause you a data loss, so before unlocking a file make sure you know what you're doing.

For more advanced users that still prefer GUI to find out what is Locking a file you can also check out Microsoft Process Explorer (advabced task manager) like tool.
If you haven't tried Process Explorer be sure to take a look at it as its a great tool for Win SysAdmins:

Process Explorer is very handy if you want to explore which .DLL (Windows Libraries) are used by a Process / Program

Windows-process-explorer-an-advanced-task-manager-for-windows-and-handy-tool-to-see-what-external-libraries-and-files-a-program-is-using.png

Windows-process-explorer-an-advanced-task-manager-for-windows-and-handy-tool-to-see-what-external-libraries-and-files-a-program-is-using-1

 

Satanism in Rock (Satan’s Music)

Wednesday, September 16th, 2009

Today one of the fellow-tenants of Nomen, a friend of mine in whom I’m staying right now
Was disbelieving that a lot of the rock and Metal is heavily involved with Satanism and
suchalike. Thus I had to show her a bunch of videos in youtube which showed clearly
how many of the rock musicians incorporate a lot of satanic messages if the message is reverse
played back. One of the most famous songs in which this tendency is clearly showed is
Led Zeppelin’s Stairway to heaven.
Here is video in youtube showing the reverse speech version of the song Led Zeppelin’s Stairway to heaven reverse speeched
.There is some interesting things on the following website even though many of the things mentioned there are a bit exaggerated.
If you’d like more on the topic make sure you check out in youtube some key phrases like “satanism in rock”, “satan in music, reverse speech” etc.
END—–

Useful BSD tips

Saturday, January 26th, 2008

I have collected a bunch of useful bsd tips stored into files they can be seen here bsd_tips Also something very precious as tips is the wiki of gongoputch (a kewl guy hanging around on irc.freenode.net ##freebsd). Here is the Wiki too bsdtips . Now about my day a normal day like everyday more or less :). I have fasted and prayed for 3 days only on water I feel really good now. I have to fast again soon. Weakening the flesh definetely enpowers The Spirit! :).I was very nicely surpriced today when I went to the Stephanie’s office (Our teacher from Holland) and find out that I have passed the HRQM exam with 4.5 ! As usually I prayed before the exam trusting on the Lord’s guidance and help and he led me and helped me! Blessed be the God of Israel 🙂 For his mercies to me (like to everybody on earth 🙂 are countless. Today I found Classic.Games.Collection.1982-1987 and I intend to walk through the games and have some fun :). END—–

Ditaa convert ASCII diagrams into bitmap graphic (pictures)

Monday, May 12th, 2014

ditta_convert-ascii-art-diagram-to-png-jpg-picture
As part of my passion for ASCII art, I've found another interesting tool useful to ASCII art maniacs like me, the tool is called ditta and is able to convert manually drawn ASCII art diagrams to graphics, below is tool description from my debian apt-cache as well as a screenshot:

 apt-cache show ditaa|grep -i ditaa -A 4

Package: ditaa
Priority: optional
Section: graphics
Installed-Size: 164
Maintainer: David Paleino <dapal@debian.org>

Filename: pool/main/d/ditaa/ditaa_0.9+ds1-2_all.deb
Size: 107270
MD5sum: 05ec52d9274b954b053f1835ca5d7a7f
SHA1: 792d91d05fff2a2a19c0ebce317351d138436c18
SHA256: c4319d32e7918aab782e2f38cdad745bc9023f9f09a999033d983095ee4f70d5

 DiTAA is a small command-line utility that can convert diagrams drawn using
 ASCII art ("drawings" that contain characters that resemble lines, like | /
 and -), into proper bitmap graphics.
 .
 DiTAA also uses special markup syntax to increase the possibilities of shapes
 and symbols that can be rendered.
Homepage: http://ditaa.org

 

To install ditaa on Debian and Ubuntu Linux:

debian:~# apt-get install --yes ditaa
...

Ditaa text diagram to Graphics converter is also available in Fedora Linux and in Source RPMs to be used on Redhat Based RPM distributions.
To install in most of RPM based Linuxes:

[root@fedora:~]# yum install -y ditaa

For most people probably Ditta will not be of any value except as a PoC and of a Hack value just like Ditaa's home page suggests. Nomatter that Ditta is cool but has just 2 drawback it doesn't understand non-latin characters i.e. Cyrillic and requires Java Virtual Machine .. but if you're a real geek you will do  the sacrifice to install a whole bunch of the heavy java for the sake of some oldschool fun 🙂 Being written in Java makes Ditta multi-platform, but you will need a Java VM version of at least 1.6 (it doesn't work with Java 1.5).

The format Ditta understands is close to HTML

<ditaa [optional parameters]>
 
... (some ditaa-code) ...
 
</ditaa>


There are also special tags understood by Ditta which are automatically turned into shaped graphical buttons and forms.
 

Possible tags

Not all shape selector tags are documented on the ditaa site. A quick source scan revealed:

tag Description
{c} decision(Choice)
{d} document
{io} input/output, parallelogram
{mo} manual operation
{o} ellipse, circle
{s} storage
{tr} trapezoid (looks like an inverted {mo} )

Here is an example Ditta code
 

<ditaa round noedgesep right>
+--------+   +-------+    +-------+
|        | --+ ditaa +--> |       |
|  Text  |   +-------+    |diagram|
|Document|   |!magic!|    |       |
|     {d}|   |  c478 |    |       |
+---+----+   +-------+    +-------+
:                         ^
|       Lots of work      :
+-------------------------+
</ditaa>

This Ditta code will generate following picture:

ditaa_convert-ascii-art-picture-to-graphic-png-jpg-bmp


To learn more on ditta please check Ditaa's Project homepage on Sourceforge
Many thanks to Cybercity's 30 Cool Open Source Software of 2013 for inspiring this post.

Malwarebytes a good Anti-Spyware anti-malware Windows program

Saturday, December 11th, 2010

malwarebytes_a_good_Anti-Spyware-anti-malware-windows-program-clean-your-pc-from-malwares-and-viruses
Dave just recommended me a nice software which is able to easily extinguish most of the nowdaysterrible spyware soft.
I had previously installed a cracked version of Spyware Doctor on this Windows machine and it was interesting that even though it’s so seriously praised the Spyware Doctor wasn’t able to find a bunch of stupid spyware.
Talking about Spyware what is a Spyware? Why is not a spyware a virus?

Anyways, I guess they just came up with a hype word to just market some more software as an anti-spyware soft.

To clean up your windows pc with go straigh to Malwarebytes download it and install it.
The full version of malwarebytes is paid but the good news is that the free version available for download lacks only the service of an integrated windows agent to constantly track your pc if a spyware is trying to enter from a website.

Just until recently I used to use the good old Spybot but this program is not anymore finding most of the malicious stuff, so I guess this malwarebytes is something I should install more often on Windows pcs I had to fix up.

safemode_with_networking_windows-PC-boot-option-screen-screenshot

If running Spyware Bytes, doesn’t succeed in cleaining the PC (and just if you want to have better guarantee that Malware will not auto-load on the PC again), run the PC in Safe Mode With Networking or just Safe Mode (keep pressing F8) before Windows boots and then run Malware Bytes again.

Play Ascii Games on Pc-freak – Get back memories of the ASCII times

Tuesday, August 4th, 2009

I was considering starting a new ‘ascii games service’. Thus I’ve created a user `play` to provide a bunch of nice FreeBSD based ascii games able to be played directly through SSH (For all lacking a nice tty compatible client like gnome-terminal), try with PuTTY . To play the games:

telnet or ssh to: ascii-games.www.pc-freak.net
login with user: play
password: playnow

Enjoy!