代码改变世界

文章分类 -  Linux(转)

SSH login without password

2014-02-25 01:38 by Rollen Holt, 647 阅读, 收藏, 编辑
摘要: Your aimYou want to use Linux and OpenSSH to automize your tasks. Therefore you need anautomaticlogin from host A / user a to Host B / user b. You don't want to enter any passwords, because you want to callsshfrom a within a shell script.How to do itFirst log in on A as user a and generate a pai 阅读全文

Linux性能测试 top衍生命令 atop/htop/slaptop

2012-08-01 21:32 by Rollen Holt, 925 阅读, 收藏, 编辑
摘要: 转自:http://www.cnblogs.com/txw1958/archive/2012/07/26/linux-from-top.html1. AtopAtop 是一个类似 top 的工具,但比 top 更有料。通过 Atop,你能够监视 Linux 系统的性能状况,包括进程活动、CPU、内存、硬盘、网络等方面的使用情况等。2. htophtop——一个可以让用户与之交互的进程查看器。作为文本模式的应用程序,主要用于控制台或 X 终端中。当前具有按树状方式来查看进程,支持颜色主题,可以定制等特性。与 top 相比,htop 包含的优点有:可以横向或纵向滚动浏览进程列表,以便看到所有的进程 阅读全文

linux常用svn命令

2012-07-26 14:39 by Rollen Holt, 273 阅读, 收藏, 编辑
摘要: 原地址:http://www.rjgc.net/control/content/content.php?nid=4418 1、将文件checkout到本地目录svn checkout path(path是服务器上的目录)例如:svn checkout svn://192.168.1.1/pro/domain简写:svn co 2、往版本库中添加新的文件svn add file例如:svn addtest.php(添加test.php)svn add *.php(添加当前目录下所有的php文件) 3、将改动的文件提交到版本库svn commit -m “LogMessage“ [-N] [--n 阅读全文

解决wubi安装ubuntu时要下载系统映像文件问题

2012-07-24 23:04 by Rollen Holt, 4047 阅读, 收藏, 编辑
摘要: 下面我介绍解决wubi安装ubuntu时要去官网下载系统映像文件问题的方法,分为两部分来介绍:问题描述及失败方案解决方案1、问题描述及失败方案问题描述就描述吧,还介绍什么失败方案,我这是为了让读者不重蹈覆辙!废话不多说了,直接进入主题——wubi安装ubuntu为我们提供很大的方便,虽然损失了一点性能,但这是可以接受的。但是用wubi安装ubuntu时,它会去ubuntu系统的iso文件!安装过程如下图所示:图1、设置好wubi后安装图示 图2、过了一会后就到这个界面了,下载ISO文件图3、下载ISO文件的过程,这还算比较好的才需要3个多小时, 我29号那天安装时提示要2000多个小时(可能现 阅读全文

Get local ip in C on linux

2012-07-14 00:13 by Rollen Holt, 1583 阅读, 收藏, 编辑
摘要: The local ip is the source ip in IP packets send out from a system. The kernal maintains routing tables which it uses to decide the default gateway , its interface and the local ip configured for that interface. The/proc/net/routefile (not really a file but appears like one) has more information abo 阅读全文

Get ip address from hostname in C using Linux sockets

2012-07-14 00:10 by Rollen Holt, 1372 阅读, 收藏, 编辑
摘要: Here are 2 methods to get the ip address of a hostname :The first method uses the traditional gethostbyname function to retrieve information about a hostname/domain name.Code1#include<stdio.h> //printf2#include<string.h> //memset3#include<stdlib.h> //for exit(0);4#include<sys/so 阅读全文

Whois client code in C with Linux sockets

2012-07-14 00:08 by Rollen Holt, 660 阅读, 收藏, 编辑
摘要: A whois client is a program that will simply fetch the whois information for a domain/ip address from the whois servers. The code over here works according to the algorithm discussed here.Code1/*2* @brief3* Whois client program4*5* @details6* This program shall perform whois for a domain and get you 阅读全文

ubnutu设置设置屏幕分辨率

2012-07-13 23:59 by Rollen Holt, 285 阅读, 收藏, 编辑
摘要: 当然我知道ubnutu有图形用户界面可以设置分辨率,但是此文将的是自己手动设置。Ubuntu 9.04 did not detect the native resolution of my new LCD monitor which was 1440 x 900.Fix :1. Get the modeline for the required resolution + refresh rate using the gtf command.1desktop:~$ gtf 1440 900 7523# 1440x900 @ 75.00 Hz (GTF) hsync: 70.50 kHz; pcl 阅读全文

Raw Sockets programming on Linux with C

2012-07-13 23:52 by Rollen Holt, 323 阅读, 收藏, 编辑
摘要: Raw sockets or packets contain user defined IP headers. Its as simple as that.Here we shall consider sending a raw tcp packets. A tcp packets has 3 parts : IP header + TCP header + dataThe structure of IP Header as given by RFC 791 is :10 1 2 320 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 阅读全文

SYN Flood DOS Attack with C Source Code

2012-07-13 23:46 by Rollen Holt, 3618 阅读, 收藏, 编辑
摘要: TCP/IP 3-way handshake is done to establish a connection between a client and a server. The process is :1. Client –SYN Packet–> Server2. Server –SYN/ACK Packet –> Client3. Client –ACK Packet –> ServerThe above 3 steps are followed to establish a connection between source and destination.SYN 阅读全文

Tcp syn portscan code in C with Linux sockets

2012-07-13 23:38 by Rollen Holt, 2007 阅读, 收藏, 编辑
摘要: Port Scanning searches for open ports on a remote system. The basic logic for a portscanner would be to connect to the port we want to check. If the socket gives a valid connection without any error then the port is open , closed otherwise (or inaccessible, or filtered).This basic technique is calle 阅读全文

28个Unix/Linux的命令行神器

2012-07-12 12:54 by Rollen Holt, 661 阅读, 收藏, 编辑
摘要: 下面是Kristóf Kovács收集的28个Unix/Linux下的28个命令行下的工具(原文链接),有一些是大家熟悉的,有一些是非常有用的,有一些是不为人知的。这些工具都非常不错,希望每个人都知道。本篇文章还在Hacker News上被讨论,你可以过去看看。我以作者的原文中加入了官网链接和一些说明。dstat & sariostat, vmstat, ifstat 三合一的工具,用来查看系统性能(我在《性能调优攻略》中提到过那三个xxstat工具)。官方网站:http://dag.wieers.com/rpm/packages/dstat/你可以这样使用:1al 阅读全文

C Packet Sniffer Code with Libpcap and Linux Sockets (BSD)

2012-07-11 09:04 by Rollen Holt, 825 阅读, 收藏, 编辑
摘要: Libpcapis a packet capture library which can be used to sniff packets or network traffic over a network interface.Pcap Documentationgives a description of the methods and data structures available in the libpcap library.To install libpcap on your linux distro you can either download the source from 阅读全文

Packet Sniffer Code in C using Linux Sockets (BSD) – Part 2

2012-07-11 00:52 by Rollen Holt, 835 阅读, 收藏, 编辑
摘要: In theprevious partwe made a simple sniffer which created a raw socket and started receiving on it. But it had few drawbacks :1. Could sniff only incoming data.2. Could sniff only TCP or UDP or ICMP or any one protocol packets at a time.3. Provided IP frames , so ethernet headers were not available. 阅读全文

Packet Sniffer Code in C using Linux Sockets (BSD)

2012-07-11 00:49 by Rollen Holt, 2949 阅读, 收藏, 编辑
摘要: Basic SnifferTo code a sniffer in C (Linux) the steps would be :1. Create a Raw Socket.2. Put it in a recvfrom loop.A raw socket when put in recvfrom receives all incoming packets. The following code shows an example of such a sniffer. Note that it sniffs only incoming packets. For sniffing all traf 阅读全文

TCPDUMP快速入门手册

2012-07-11 00:02 by Rollen Holt, 359 阅读, 收藏, 编辑
摘要: TCPDUMP简介在如今众多的黑客技术中,嗅探器(sniffer)是最常见,也是最重要的技术之一。用过windows平台上的sniffer工具(例如,netxray和sniffer pro软件)的朋友可能都知道,在共享式的局域网中,采用sniffer工具简直可以对网络中的所有流量一览无余!Sniffer工具实际上就是一个网络上的抓包工具,同时还可以对抓到的包进行分析。由于在共享式的网络中,信息包是会广播到网络中所有主机的网络接口,只不过在没有使用sniffer工具之前,主机的网络设备会判断该信息包是否应该接收,这样它就会抛弃不应该接收的信息包,sniffer工具却使主机的网络设备接收所有到达的 阅读全文

使用socket BPF

2012-07-10 23:39 by Rollen Holt, 5588 阅读, 收藏, 编辑
摘要: http://blog.donews.com/quickmouse/archive/2004/11/17/173266.aspx第一次听说socket BPF的东西是CTO说sniffer要注意效率问题,需要针对规则设定一定的过滤规则,这样可以减少程序在用户空间和内核空间的切换。于是就去google那个东西了。不过结果并不是很理想的,似乎研究这个的人不多。从方方面面的情况看,似乎用libpcap库设置BPF的过滤器是比较容易的,但是我的机器并没有装libpcap,man了半天就是没有东西,呵呵。不过折腾了一下也是弄出来了,那都是大半年前的事情了。今天写程序又用到BPF了,突然想到应用过程当中有 阅读全文

Linux下Sniffer程序的实现

2012-07-10 22:47 by Rollen Holt, 4900 阅读, 收藏, 编辑
摘要: 作者:Gianluca Insolvibile整理:Seal(永远的FLASH)出处:http://www.nsfocus.com日期:2003-04-02嗅探——Sniffer技术是网络安全领域里一项非常重要的技术!对于“Hacker”来说,他们可以以非常隐蔽的方式得到网络中传输的大量的敏感信息,如Telnet,ftp帐号和密码等等明文传送的信息!与主动扫描相比,嗅探的行为更加难以被察觉,操作起来也不是很复杂!对于网络管理人员来说,可以利用嗅探技术对网络活动进行监控,并及时发现各种攻击行为!在这篇文章里,我们主要探讨在Linux下如何利用C语言来实现一个Sniffer!我们将假设所有的主机在 阅读全文

网络抓包工具

2012-07-10 22:06 by Rollen Holt, 3382 阅读, 收藏, 编辑
摘要: http://blog.csdn.net/wangxg_7520/article/details/2795229看了太多的“自己动手”,这次咱也“自己动手”一下,写个简单的网络抓包工具吧。要写出像tcpdump和wireshark(ethereal)这样的大牛程序来,咱也没那能耐,呵呵。所以这个工具只能抓取本地IP数据报,同时它还使用了BPF,目的是了解如何进行简单有效的网络抓包。当打开一个标准SOCKET套接口时,我们比较熟悉的协议往往是用AF_INET来建立基于TCP(SOCK_STREAM)或UDP(SOCK_DGRAM)的链接。但是这些只用于IP层以上,要想从更底层抓包,我们需要使用A 阅读全文

vmware虚拟机里的LINUX不能上网的原因一:虚拟网卡设置

2012-07-07 19:27 by Rollen Holt, 15578 阅读, 收藏, 编辑
摘要: http://hi.baidu.com/1986v5/item/2e4f1a152ded65038ebde48c得出结论,如果你的电脑里有两个网卡,都是在一个网段内,那么访问本网段内的其他主机就会有问题,因为路径选择会出错错乱。当然是指两个网卡都启动的情况。Linux 网络接口配置文件及相关工具 (v0.1b)作者:北南南北来自:LinuxSir.Org摘要:本文是关于网络接口有关配置工具的介绍,其中介绍了各大Linux发行版本的网卡的配置文件及相应的特色配置网络工具; 对 ifconfig 和netconfig 进行了解说,对ADSL猫的拔号工具rp-pppoe 进行了详细说明,也对普通猫的 阅读全文