namespace common
...
catch(exception)
...
ipendpoint ipepserver = new ipendpoint(serverhe.addresslist[0], 0);
endpoint epserver = (ipepserver);
fromhe = dns.gethostbyname(dns.gethostname());
ipendpoint ipendpointfrom = new ipendpoint(fromhe.addresslist[0], 0);
endpoint endpointfrom = (ipendpointfrom);
int packetsize = 0;
icmppacket packet = new icmppacket();
packet.type = icmp_echo;
packet.subcode = 0;
packet.checksum = uint16.parse("0");
packet.identifier = uint16.parse("45");
packet.sequencenumber = uint16.parse("0");
int pingdata = 32;
packet.data = new byte[pingdata];
for (int i = 0; i < pingdata; i++)
...
packetsize = pingdata + 8;
byte icmp_pkt_buffer = new byte[ packetsize ];
int32 index = 0;
index = serialize(
packet,
icmp_pkt_buffer,
packetsize,
pingdata );
if( index == -1 )
...
double double_length = convert.todouble(index);
double dtemp = math.ceiling( double_length / 2);
int cksum_buffer_length = convert.toint32(dtemp);
uint16 cksum_buffer = new uint16[cksum_buffer_length];
int icmp_header_buffer_index = 0;
for( int i = 0; i < cksum_buffer_length; i++ )
...
uint16 u_cksum = checksum(cksum_buffer, cksum_buffer_length);
packet.checksum = u_cksum;
byte sendbuf = new byte[ packetsize ];
index = serialize(
packet,
sendbuf,
packetsize,
pingdata );
if( index == -1 )
...
dwstart = system.environment.tickcount;
if ((nbytes = socket.sendto(sendbuf, packetsize, 0, epserver)) == socket_error)
...
byte receivebuffer = new byte[256];
nbytes = 0;
bool recd =false ;
int timeout=0 ;
while(!recd)
...catch(exception ex)
...if (nbytes == socket_error)
...
else if(nbytes>0)
...
timeout=system.environment.tickcount - dwstart;
if(timeout>1000)
...
} socket.close();
return tmp;
} public static void pinghost(string host)
...
catch(exception)
...
ipendpoint ipepserver = new ipendpoint(serverhe.addresslist[0], 0);
endpoint epserver = (ipepserver);
fromhe = dns.gethostbyname(dns.gethostname());
ipendpoint ipendpointfrom = new ipendpoint(fromhe.addresslist[0], 0);
endpoint endpointfrom = (ipendpointfrom);
int packetsize = 0;
icmppacket packet = new icmppacket();
packet.type = icmp_echo;
packet.subcode = 0;
packet.checksum = uint16.parse("0");
packet.identifier = uint16.parse("45");
packet.sequencenumber = uint16.parse("0");
int pingdata = 32;
packet.data = new byte[pingdata];
for (int i = 0; i < pingdata; i++)
...
packetsize = pingdata + 8;
byte icmp_pkt_buffer = new byte[ packetsize ];
int32 index = 0;
index = serialize(
packet,
icmp_pkt_buffer,
packetsize,
pingdata );
if( index == -1 )
...
double double_length = convert.todouble(index);
double dtemp = math.ceiling( double_length / 2);
int cksum_buffer_length = convert.toint32(dtemp);
uint16 cksum_buffer = new uint16[cksum_buffer_length];
int icmp_header_buffer_index = 0;
for( int i = 0; i < cksum_buffer_length; i++ )
...
uint16 u_cksum = checksum(cksum_buffer, cksum_buffer_length);
packet.checksum = u_cksum;
byte sendbuf = new byte[ packetsize ];
index = serialize(
packet,
sendbuf,
packetsize,
pingdata );
if( index == -1 )
...
dwstart = system.environment.tickcount;
if ((nbytes = socket.sendto(sendbuf, packetsize, 0, epserver)) == socket_error)
...
byte receivebuffer = new byte[256];
nbytes = 0;
bool recd =false ;
int timeout=0 ;
while(!recd)
...
else if(nbytes>0)
...
timeout=system.environment.tickcount - dwstart;
if(timeout>1000)
...
} socket.close();
} public static int32 serialize(icmppacket packet, byte buffer,
int32 packetsize, int32 pingdata )
...
cbreturn = index;
return cbreturn;
} public static uint16 checksum( uint16 buffer, int size )
...
cksum = (cksum >> 16) + (cksum & 0xffff);
cksum += (cksum >> 16);
return (uint16)(~cksum);
} }
public class icmppacket
...
}
Linux檢視是否被入侵
一.檢查系統日誌 lastb命令檢查系統錯誤登陸日誌,統計ip重試次數 二.檢查系統使用者 1 cat etc passwd檢視是否有異常的系統使用者 2 grep 0 etc passwd檢視是否產生了新使用者,uid和gid為0的使用者 3 ls l etc passwd檢視passwd的修改時...
webrender 檢視是否開啟 檢視埠是否啟用
檢視埠是否啟用兩個方法 1 telnet ip 埠 如 檢視1433埠是否啟用 在cmd中執行 telnet 192.168.0.102 1433,如果顯示乙個游標表示埠已經開啟在用,否則未開啟該埠。2 netstat ano 列出當然監聽埠,連線埠等資訊 如檢視8888商品是否啟用,在cmd中執行...
查詢orcle版本,檢視是否死鎖
檢視oracle版本 select from v version 檢視被鎖的表 select b.owner,b.object name,a.session id,a.locked mode from v locked object a,dba objects b where b.object id...