Search
Tuesday, 17 August 2010
Quick port scan of a machine
nmap
Not installed by default on Ubuntu or Mint, use:
sudo apt-get install nmap
Not installed by default on Ubuntu or Mint, use:
sudo apt-get install nmap
Change hostname in linux
Using suitable privelages, navigate to /etc and edit the following files, replacing the default name with your desired machine name. Prefereably the FQDN.
/etc/hosts
/etc/hostname
/etc/hosts
/etc/hostname
Thursday, 8 July 2010
Tika and Solr
To index Word, Excel, PDF and other "unstructured" documents, Solr uses Tika, another Apache project.
Tika comes bundled in Solr and is ready to run in Solr. However, if you want to run Tika individually you have to copy a few .jar files around.
cd [Your path]/apache-solr-nightly/lib cp commons-io-1.4.jar commons-codec-1.3.jar [Your path]/apache-solr-nightly/example/solr/lib cp ~/.m2/repository/org/jempbox/jempbox/0.2.0/jempbox-0.2.0.jar [Your path]/apache-solr-nightly/example/solr/lib
java -jar tika-0.2.jar
Config
If you want to index Word, Excel, PDF, and other types of documents, there is a bit of additional configuration to do. To index those files types you have to get a nightly build of Solr from here, and copy some files and directories as described in the link at the end of this post. You have to add the following lines to example/solr/conf/solrconf.xml:
last_modified
true
Monday, 28 June 2010
Bitnami Stacks
Just discovered these and they are pretty awesome. If you just want to test a Wordpress idea and don't want to build a whole VM then download a stack:
http://bitnami.org/stack/wordpress
http://bitnami.org/stack/wordpress
Wednesday, 5 May 2010
Linux logs - just so I remember
Most logs are stored in the /var/log/ directory
Over a period of time log files grow too large and are rotated, with the older logs being compressed and appended with .gz
Rotation is handled by the logrotate utility which is governed by the /etc/logrotate.conf file
The /etc/logrotate.d directory contains configs for individual log files such as apt etc.
Over a period of time log files grow too large and are rotated, with the older logs being compressed and appended with .gz
Rotation is handled by the logrotate utility which is governed by the /etc/logrotate.conf file
The /etc/logrotate.d directory contains configs for individual log files such as apt etc.
Thursday, 29 April 2010
Linux detective work
When looking at logs, if an attack has taken place and the IP can be discovered of the attacking machine, then it is possible to reverse trace the attacker and potentially find out their pc details, open ports, isp etc.
From linux, open a bash terminal:
dig -x 1.2.3.4
Where 1.2.3.4 is an IP address. This command may return a pointer record. Next, try a whois:
whois 1.2.3.4
This command should give the netblock owner, ISP etc. You can also try using the commands available at www.robtex.com
Finally, try an nmap command:
nmap -O 1.2.3.4
Tuesday, 20 April 2010
Determining free disk space in Linux
Just use the df command:
df /
or
df -P
will generate a usage table.
To just extract the 'used' portion:
df=($(LC_ALL=C df -P /)); echo "${df[11]}"
Email the report from a shell script:
df -h | mail -s “disk space report” fromage@cheese.com
If you don't have mail installed, you can use sendmail, which would be:
df-h | sendmail fromage@cheese.com
OR if you want to get the results of this (or any other linux command) in a pop up x window then first redirect the output of a command to a file:
df -h > otterlog.txt
Then open this file in a pop up:
xmessage -file otterlog.txt
df /
or
df -P
will generate a usage table.
To just extract the 'used' portion:
df=($(LC_ALL=C df -P /)); echo "${df[11]}"
Email the report from a shell script:
df -h | mail -s “disk space report” fromage@cheese.com
If you don't have mail installed, you can use sendmail, which would be:
df-h | sendmail fromage@cheese.com
OR if you want to get the results of this (or any other linux command) in a pop up x window then first redirect the output of a command to a file:
df -h > otterlog.txt
Then open this file in a pop up:
xmessage -file otterlog.txt
Labels:
df,
df -P,
df/,
disk,
free space,
hard disk,
linux,
linux disk space,
space
Useful Bash script stuff
When writing shell scripts it is sometimes useful to pop up a message in X or display a file, use the following to do so:
xmessage "this is my message"
xmessage -center "Hello World"
xmessage -center -file "opensomefile.txt"
xmessage "this is my message"
xmessage -center "Hello World"
xmessage -center -file "opensomefile.txt"
Subscribe to:
Posts (Atom)