Network Device Up and Down
$ service network restart
$ /etc/init.d/network restart
$ service network start
$ service network stop
$ifdown eth0
$ifup eth0
$ ifconfig
$ dhclient
Name Server
$ vim /ect/resolv.conf
[root@sr1s1 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 129.174.97.3
nameserver 129.174.68.227
nameserver 129.174.1.3
HostName
$ echo hostname=$HOSTNAME >> /etc/sysconfig/network
set hostname
Routing Table
$ route
show the routing tables
IP Table
$ iptables --list
view all of the ip table rules
Opening Ports
$lsof -i
Start SSH
$ service sshd restart
Automatically Start SSH on Boot
$ chkconfig --level 5 --del sshd
$ chkconfig --level 5 --add sshd
Query system running service
$ chkconfig
Update bashrc or profile
$ source ~/.profile
Monday, July 1, 2013
Thursday, June 20, 2013
Install OpenVZ on CentOS
Installation: I successfully installed OpenVZ on CentOS 6.4, but CentOS 5.5 has booting problem after switching to OpenVZ kernel
http://openvz.org/Quick_installation
https://openvz.org/Quick_Installation_CentOS_6
Create and Run a Container:
http://openvz.org/Basic_operations_in_OpenVZ_environment
http://openvz.org/Quick_installation
http://openvz.org/Quick_installation
https://openvz.org/Quick_Installation_CentOS_6
Create and Run a Container:
http://openvz.org/Basic_operations_in_OpenVZ_environment
http://openvz.org/Quick_installation
Change hostname on CentOS
$vim /etc/sysconfig/network
Change the HOSTNAME to anything you like
e.g.: sr1s5
Change the HOSTNAME to anything you like
e.g.: sr1s5
Thursday, June 13, 2013
fix touchpad sensitive issue on ubuntu of Chromebook
http://craigerrington.com/blog/fixing-touchpad-issues-on-arm-chromebook-chrubuntu/
mkdir ~/backup sudo mv /usr/share/X11/xorg.conf.d/* ~/backup/ cd /usr/share/X11/xorg.conf.d/ (you can issue an ls here to make sure the dir is empty if you like) sudo wget http://craigerrington.com/chrome/x_alarm_chrubuntu.zip sudo unzip x_alarm_chrubuntu.zip sudo rm x_alarm_chrubuntu.zip
NOTE: This will set up a UK keyboard, follow these simple steps to change it:
Example:
sudo vi /usr/share/X11/xorg.conf.d/10-keyboard.conf
reboot
Ubuntu file system becomes read only
My Ubuntu on Chromebook has this problem, and it fixed by $fsck -Af
Source Link is:
http://askubuntu.com/questions/197459/read-only-file-system
Source Link is:
http://askubuntu.com/questions/197459/read-only-file-system
The filesystem will usually go into read-only while the system is running if there is a filesystem consistency issue. This is specified in
fstab as errors=remount-ro and will occur when a FS access fails or an emergency read-only remount is requested via Alt+SysRq+U. You can run:sudo fsck -Af
to force a check of all filesystems. As the other very good answer states, looking at
dmesg is also very helpful.Friday, June 7, 2013
Capture The Flag notes
Here are some notes for capture the flag:
1. Use backtrack, because it has been installed many attacking tools including Metasploit
2. Use nmap to scan a target host, and identify what services are running
$ nmap -A -T4 www.hostIP.com
-A: Enable OS detection, version detection, script scanning, and traceroute
1. Use backtrack, because it has been installed many attacking tools including Metasploit
2. Use nmap to scan a target host, and identify what services are running
$ nmap -A -T4 www.hostIP.com
-A: Enable OS detection, version detection, script scanning, and traceroute
-T4 for faster execution
nmap cheatsheet: https://tiw2013.cse.psu.edu/slides/cheat_sheet.pdf
3. Go to securityfocus website, use the service name and version as the keyword, then find out if there is an vulnerability for that service.
securityfocus: http://www.securityfocus.com/vulnerabilities
e.g., vsftpd, irc2
4. Open Metasploit to exploit the vulnerability
$ msfconsole
$ use /unix/vsftpd/exploit-path
$ set rhost target-IP
$ exploit
Metasploit set lhost to current IP and payload to reverse-shell as default.
Additional Tips:
1) try rlogin and rsh commands
$ rlogin -l username Target-IP
$ rsh -l username Target-IP
2) take a look at port 1524. If it is open, try to login with netcat
$nc TargetIP 1524
Thursday, May 2, 2013
Access x86 debug register DR0 to DR7
x86 debug register allow access in ring0 or SMM.
On Windows, you may want to write a device driver to run your code
On Linux, you need to write a kernel module to run your code
This sample code sets the DR0 to value 0x4013c8, which is an entry point of a program. It also sets the DR7 to value 0x401, which is to enable local breakpoint of DR0.
Tested code is following:
u32 dr0_RD=0xff;
u32 dr7_RD=0xff;
asm __volatile__ (
"mov %%dr0, %0\n"
"mov %%dr7, %1\n"
:"=r"(dr0_RD), "=r"(dr7_RD)
);
printk("\ndr0_RD is: %x\ndr7_RD is: %x\n", dr0_RD, dr7_RD);
asm __volatile__ (
"movl $0x401, %eax\n"
"movl %eax, %dr7\n"
"movl $0x4013c8, %eax\n"
"movl %eax, %dr0\n"
);
asm __volatile__ (
"mov %%dr0, %0\n"
"mov %%dr7, %1\n"
:"=r"(dr0_RD), "=r"(dr7_RD)
);
printk("\ndr0_RD is: %x\ndr7_RD is: %x\n", dr0_RD, dr7_RD);
Notes about inline gcc assembly
For the block of code in red, I cannot do movl $0x401, %dr4; Additionally, I cannot define a variable u32 dr7 =0x401, and pass it to the inline gcc assembly, "movl %0, %%dr7\n":"=r"(dr7)
Additionally, if there is a paramater passing, all of the register need to use two percent. Otherwise compile error will generates.
On Windows, you may want to write a device driver to run your code
On Linux, you need to write a kernel module to run your code
This sample code sets the DR0 to value 0x4013c8, which is an entry point of a program. It also sets the DR7 to value 0x401, which is to enable local breakpoint of DR0.
Tested code is following:
u32 dr0_RD=0xff;
u32 dr7_RD=0xff;
asm __volatile__ (
"mov %%dr0, %0\n"
"mov %%dr7, %1\n"
:"=r"(dr0_RD), "=r"(dr7_RD)
);
printk("\ndr0_RD is: %x\ndr7_RD is: %x\n", dr0_RD, dr7_RD);
asm __volatile__ (
"movl $0x401, %eax\n"
"movl %eax, %dr7\n"
"movl $0x4013c8, %eax\n"
"movl %eax, %dr0\n"
);
asm __volatile__ (
"mov %%dr0, %0\n"
"mov %%dr7, %1\n"
:"=r"(dr0_RD), "=r"(dr7_RD)
);
printk("\ndr0_RD is: %x\ndr7_RD is: %x\n", dr0_RD, dr7_RD);
Notes about inline gcc assembly
For the block of code in red, I cannot do movl $0x401, %dr4; Additionally, I cannot define a variable u32 dr7 =0x401, and pass it to the inline gcc assembly, "movl %0, %%dr7\n":"=r"(dr7)
Additionally, if there is a paramater passing, all of the register need to use two percent. Otherwise compile error will generates.
Subscribe to:
Posts (Atom)