Category: Linux

Linux

Change Ubuntu server from DHCP to a static IP address

1. Open interfaces file for editing: sudo nano / etc/network/interfacessudo nano / etc/network/interfaces 2. Change interfaces file contents to: auto eth0 iface eth0 inet static address 192.168.10.15 netmask 255.255.255.0 network 192.168.10.0 gateway 192.168.10.1 dns-nameservers 192.168.10.1 8.8.8.8auto eth0 iface eth0 inet static address 192.168.10.15 netmask 255.255.255.0 network 192.168.10.0 gateway 192.168.10.1 dns-nameservers 192.168.10.1 8.8.8.8 You will have …

Linux

Quick FTP Server Installation

Installation sudo apt-get install vsftpdsudo apt-get install vsftpd Upload files By default vsftpd is configured to authenticate system users and allow them to download files. If you want users to be able to upload files, edit configuration file: sudo nano / etc/vsftpd.confsudo nano / etc/vsftpd.conf write_enable=YES Restart vsftpd sudo service vsftpd restartsudo service vsftpd restart …

C, Drivers, Linux, Rootkits

Hello World Linux Module

Hello World Module #include <linux/init.h> #include <linux/module.h>   static int init_module(void) { printk(KERN_ALERT "Hello, world!n"); return 0; }   static void clean_module() { printk(KERN_ALERT "Goodbye, world!n"); }#include <linux/init.h> #include <linux/module.h> static int init_module(void) { printk(KERN_ALERT "Hello, world!n"); return 0; } static void clean_module() { printk(KERN_ALERT "Goodbye, world!n"); } Compile – Makefile ifneq ($(KERNELRELEASE),) obj-m := …

Linux, Python

Simple python sniffer with pcapy and impacket

Pcapy home page Impacket home page To install pcapy and impacket: sudo apt-get install python-pcapysudo apt-get install python-pcapy sudo apt-get install python-impacketsudo apt-get install python-impacket Run the script below with root privileges. #!/usr/bin/python   import pcapy import sys from impacket import ImpactDecoder   def callback(header, data): decoder = ImpactDecoder.EthDecoder() ethernet_pck = decoder.decode(data) ip_hdr = ethernet_pck.child() …

Linux, Python

SSH authentication with Python and paramiko

paramiko home page SSH2 protocol for python.   import os import paramiko import sys   try: ssh = paramiko.SSHClient() paramiko.util.log_to_file("./errors.log") ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts"))) ssh.connect(’myserver.com’, username=’user_name’, password=’pass_word’) ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(’ls /home/username/’) print "outputn", ssh_stdout.read() error = ssh_stderr.read() print "errorsn", error, len(error) except Exception, e: print "username or password is wrong or the server …

C++, Linux

Select from SqLite with C++ in Linux

If you are using Ubuntu Linux, you can install sqlite headers by issuing the following command: sudo apt-get install libsqlite3-devsudo apt-get install libsqlite3-dev The code: #include <iostream> #include <sqlite3.h> using namespace std;   static int print_results(void *notInUse, int argc, char **argv, char **colName) { int i; for(i=0; i<argc; i++) cout << colName[i] << " = …

CentOS

Remote Desktop Support in CentOS

Remote Desktop Support Become root su -su – Installation yum install vinoyum install vino Setting up Remote Desktop Access Goto System->Preferences->Remote Desktop and enable these settings on the remote desktop window preferences: 1. Allow other users to view your desktop. 2. Allow other users to control your desktop. 3. Require the user to enter this …