This simple network trace shows the essential elements of a network interaction between a client and a server. For our test, we use the following for the client… import sys, socket, time remote_ip = socket.gethostbyname(socket.gethostname()) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #s.setsockopt(socket.IPPROTO_TCP,…
Author: Steve
Spoofed IP network behaviour
In this case, we spoof the IP of our client to 192.168.1.101. When we do this, and send only a SYN packet to the server, we see the SYN on the client… [root@cmhlcarchapp02 ~]# python spoof.py 1 09:37:52.469226 IP 192.168.1.101.49999…
PowerShell for *nix people
PowerShell is becoming (has become) the replacement for VBScript on Microsoft operating systems. It is a fairly robust scripting language that I think most administrators will be happy to see. If you have a supported Microsoft operating system (i.e., not…
Loading compressed data into MySQL in batches from python
We used what is below to load 12 million rows into a laptop MySQL database in 48 minutes. I’m sure it can be improved, but we were initially OK with this result. import gzip, os, sys, string, mysql.connector fd =…
Connection Reset – What does it mean?
Generally, it indicates your client successfully connected to the server. A subsequent attempt to use the client connection failed after the server closed the socket, or had been disconnected for any reason. You can prove this with what is below,…
How to replace newlines and maintain the surrounding text
Using regular expression groups, we can instruct whatever software we happen to be using what we want to replace. For example assuming we want to replace all newlines followed by a digit, we can use what is below in Textpad……
ORA-01002: fetch out of sequence in ATG BCC
We had an issue during a deployment in which an ORA-01002 was thrown. The interesting part is when we compile and run what is below… import java.sql.*; public class test { public static void main (String args[]) throws Exception {…
Finding the other end of a Unix pipe
If you need to see the other end of the a pipe, you can use either a find for the inode, or lsof, also on the inode. We see our process of interest is waiting on a read call from…
Great writeup on Linux memory management
…especially as it relates to committed memory… http://www.etalabs.net/overcommit.html int main() { void *m = malloc(6000*1024*1024); if (m) printf(“Memory allocation succeeded!\n”); else printf(“Memory allocation failed!\n”); //memset(m,0,2000*1024*1024); sleep(30); return 0; } [root@cmhlcarchapp01 ~]# sysctl -w vm.overcommit_memory=2 [root@cmhlcarchapp01 ~]# ./mem & [1] 7890…
SQL Server – querying active users by database
use master go declare @table table( spid int, status varchar(max), login varchar(max), hostname varchar(max), blkby varchar(max), dbname varchar(max), command varchar(max), cputime int, diskio int, lastbatch varchar(max), programname varchar(max), …