http://www.redhat.com/docs/manuals/linu ... ports.html
Good stuff...though it says Red Hat, I would guess its applicable to most Linux distros (except nmap may have to be installed for distros where it does not come by default)
Basic Idea:
- Use nmap to portscan the localhost to detect running services
- /etc/services contains list of official known services
- If an unknown service is deducted and cannot be resolved by checking above, use netstat -anp to list all(a) ports[numerically(n)] with process ids(p) being listened to. Check if the port can be found, if it can be, check the process using it. Check if it is a known process...just the fact it is listed(!) usually means its not malicious
- Also check with lsof [-i], as it also provides information linking open ports to services
[ add comment ] | [ 0 trackbacks ] | permalink | related link |




( 2.9 / 40 )Recently, working on a programming project, I had to do some string pattern matching. From prior experience, I knew "regex" was the perfect candidate. But the problem was, I was unfamiliar with it, and in the past have always relied on internet for help
Regular expressions are truly powerful, they are used for pattern matching. Let me try to express how powerful I think they are, search is one of the most basic things that most things are based off...what ever we do, we search (I believe thats why Google's so popular
Hopefully, I was able to express how much we do searches (which is based of pattern matching ~ exact match to the search term or approximate match), and how much we rely on pattern matching. This pattern matching can be done in computers using Regular Expressions!!
Getting to the actual point of this post, I decided I will list some useful tips and hints that I found from scouring the internet
(This is related to Linux in that, grep is used for searches using regex in Linux)
Sources:
http://www.regular-expressions.info/characters.html
* Regex engines are case sensitive by default, so "cat" won't match "Cat"
* "at" matches "at","cat","atwood" etc
* The following are metacharacters: [,\,^,$,.,|,?,*,+,(,) - this would change based on the engine
* To use any of these characters literally in a string you would have to escape it using a '\', so in order to use * as an actual character rather than a metacharacter in that search, you would use \* instead
* A character following a '\' can possibly have a special meaning, i.e. \d is used to represent a digit between 0 and 9 - meaning you can't 'escape' normal characters like you do for the metacharacters
Here is a list of special sequences:
* \t = tab
* \r = carriage return
* \n = line feed
CHARACTER CLASS
* [ae] matched a or e NOT ae, example gr[ae]y matches grey and gray not graey
* Ranges can be specified using a '-', so [0-9a-fA-F] specifies 1 character (hexadecimal digit, case-insensitive)
* q[^u] matches anything that has a q followed by something not a u
to be continued...
[ add comment ] | [ 0 trackbacks ] | permalink |




( 2.5 / 25 )Source: http://www.freeos.com/articles/3127/
Good article, I will quote the key points
Looking at file permissions
Given below is the result of an 'ls -l'
drwxr-x--- 2 mayank freeos 4096 Dec 28 04:09 tmp
-rw-r--r-- 1 mayank freeos 969 Dec 21 02:32 foo
-rwxr-xr-x 1 mayank freeos 345 Sep 1 04:12 somefile
Relevant information in the first column here is the file type followed by
the file permissions. The third and the fourth column show the owner of
the file and the group that the file belongs to.
The first entry here is tmp. The first character in the first column is
'd', which means the tmp is a directory. The other entries here are files,
as indicated by the '-'.
d rwx r-x ---
file type users group others
The next 9 characters define the file permissions. These permissions are
given in groups of 3 each. The first 3 characters are the permissions for
the owner of the file or directory. The next 3 are permissions for the
group that the file is owned by and the final 3 characters define the
access permissions for everyone not part of the group. There are 3
possible attributes that make up file access permissions.
r - Read permission. Whether the file may be read. In the case of a
directory, this would mean the ability to list the contents of the
directory.
w - Write permission. Whether the file may be written to or modified. For
a directory, this defines whether you can make any changes to the contents
of the directory. If write permission is not set then you will not be able
to delete, rename or create a file.
x - Execute permission. Whether the file may be executed. In the case of a
directory, this attribute decides whether you have permission to enter,
run a search through that directory or execute some program from that
directory.
Altering file permissions
chmod
The
syntax of the chmod command is quite simple. File permissions may be
defined for users (u), groups (g) and others (o).
An example of the chmod command will be
chmod u-x,g+w,o+rw somefile
The chmod command here takes away execute permission from the user, sets
the write access bit for the group and also gives read and write access to
everyone else. The file permissions for the file before this command is
executed are -rwxr-xr-. After this command, the file permissions are
-rwxrwx---. First you choose to use 'u','g' or 'o' followed by '+' to add
a permission, '-' to take it away and '=' to wipe out any previous
permission bits and set the permission bits to what is specified. You can
also use 'a' to set a permission bit for all users.
There is another way in which you can specify the file permissions. The
permission bits r,w and x are assigned a number.
r = 4
w = 2
x = 1
Now you can use numbers, which are the sum of the various permission bits.
E.g - rwx will be 4+3+1 = 7. rx becomes 4+1 = 5. The chmod command now
becomes
chmod xyz filename
where x,y and z are numbers representing the permissions of user, group
and others respectively. Each number is the sum of the permissions to be
set and are calculated as given above.
Chmod 644 somefile
Chown: Change owner of file
Chgrp: Change group of file
[ add comment ] | [ 0 trackbacks ] | permalink | related link |




( 2.8 / 17 )Sources:
http://www.ahinc.com/linux101/users.htm
http://www.cyberciti.biz/faq/howto-linu ... -to-group/
Basically,
User addition: useradd
User edition: usermod
User deletion: userdel
Group addition: groupadd (other 2 commands follow same pattern)
Change User password: password username
User and Primary Group information stored in: /etc/passwd
User passwords stored in: /etc/shadow
Group information stored in: /etc/group
Default files and directories created, when a new user is created, stored in: /etc/skel
Switch User: su (defaults to root, unless an username is specified)
[ add comment ] | [ 0 trackbacks ] | permalink |




( 2.8 / 10 )Wow...almost 2 months since my last post. I guess I got carried away by life
After some thought, I figured I'd use the desktop at home thats doing nothing as a server (I've done this before, but this time I wanted to make it permanent).
Here is a list of web servers I have tried out in the past:
* Abyss Server (and I should say, I loved it...Everything was so easy to setup, everything worked - nice thing it supported ASP .NET and php).
* Ultidev Cassini (I liked it too - this was the first ASP .NET server I discovered, OF COURSE after IIS
* NullHTTPd (May be I did not give it a good chance, it was an easy setup and all...but I found it unsatisfying...the interface and the like, I guess)
* And now the heavy weight, Apache, for my needs I guess Apache would be pretty heavy, I did give that a shot (its text files based configuration. It can give you a lot of control, a lot of information available at one point).
I was certain that I would use Abyss this time. Lets say by a twist of fate, my windows XP started having hiccups out of the blue, [I ran hardware test, Thank God! they were okay. And all of a sudden it couldn't boot into windows (symptoms look very much like a virus...the computer has a complicated past, partially my fault
I have always liked SLAX (LiveCD). It was simple, fast and always presented a thoroughly enjoyable experience
I have been reading the config files and making changes, exploring Linux, Apache and rest of the crew...I'll post useful information that I look for and find here...who knows, someone (includes me
[ add comment ] | [ 0 trackbacks ] | permalink |




( 2.7 / 10 )
Calendar



