© 2023 PodTECH IO
All rights reserved.

Get in Touch

UNIX

Ubuntu – Which Process is Using a port?

Ubuntu – Which Process is Using a port? 1- Find what application/process is using the pro, type: sudo netstat -lpn |grep :8080 and press Enter. You will get an output similar to this one tcp6       0      0 :::8080                 :::*                    LISTEN      6782/java 2- I have got the process Id, which is 6782, now this is the […]

Security UNIX

Heart Bleed – Exploit Example Code

Heart Bleed – Exploit Example Code If you need to test your server for the vulnerability, here is a simple Python script… [python] #!/usr/bin/python import sys import struct import socket import time import select import re from optparse import OptionParser options = OptionParser(usage=’%prog server [options]’, description=’Test for SSL heartbeat vulnerability (CVE-2014-0160)’) options.add_option(‘-p’, ‘–port’, type=’int’, default=443, […]

Perl

Perl – Compare Array Contents when length is identical and order matches

Perl – Compare Array Contents when length is identical and order matches Comparing arrays side by side. Do they match or dont they? @a=(1,0,1,0,0); @b=(0,0,1,0,0); NO! @arr1=(0,1,1,1,1,1,0,1); @arr2=(0,1,1,1,1,1,0,1); use Algorithm::Diff qw( LCS_length); my $arr_count1 = @arr1; my $arr_count2 = @arr2; if($arr_count1 != $arr_count2) { print “NOMATCH\n”; ## NO MATCH } else { $count = LCS_length […]

Perl

PERL – Bitwise OR XOR an array

PERL – Bitwise OR XOR an array [perl] my @data= (“80″,”80″,”7B”,”30″,”32″,”30″,”38″,”31″,”46″,”30″,”39″); my $chk; foreach my $point(@data) { $chk = $chk^$point; ## XOR each array } $chk = hex($chk)|hex(“80”); ## OR the result value my $chk_hex=sprintf(“%x”,$chk); ## convert result to hex print “$chk = $chk_hex\n”; ## display both results side by side [/perl]

UNIX

SFTP Only for a user – Debian

SFTP Only for a user – Debian Add the user info the sshd_config file in /etc/ssh/sshd_config Ensure the line is uncommented; Subsystem sftp /usr/lib/openssh/sftp-server Match User userbob ForceCommand internal-sftp ChrootDirectory /home/userbob X11Forwarding no AllowTcpForwarding no   Ensure the home directory is not group writeable. It should be 755. /etc/init.d/ssh restart service ssh restart Test the […]

Perl

Perl Hex to Binary to Decimal Conversions

Perl Hex to Binary to Decimal Conversions Dec to Hex Use function sprintf(“%x”, DECNUMBER) or sprintf(“%X”, DECNUMBER) for hexadecimal numbers with capital letters. $decvalue = 200; $hexvalue = sprintf(“%x”, $decvalue); ## gives c8 $hexvalue = sprintf(“%X”, $decvalue); ## gives C8 Dec to Oct Use sprintf(“%o”, DECNUMBER ) $decvalue = 200; $octval = sprintf( “%o”, $decvalue […]