nmap –script ssl-enum-ciphers -p 443 www.google.com you can test your script to see the difference. Here are some url that only support a specific tls version. This subdomain and port only supports TLSv1.2 https://tls-v1-2.badssl.com:1012/ This subdomain and port only supports TLSv1.1 https://tls-v1-1.badssl.com:1011/ This subdomain and port only supports TLSv1.0 https://tls-v1-0.badssl.com:1010/Read More →

$pfx_file=”mywindows_cert.pfx”; $password=”dailyithlep”; $pem_file=”mypem_cert.pem”; convert_pfx_file_to_pem($pfx_file,$password,$pem_file,true); function convert_pfx_file_to_pem($pfx_file,$password,$pem_file,$remove_password=true) { $CERT_FILE=”/tmp/certificate.crt”; $CA_CERT_FILE=”/tmp/ca-cert.crt”; $PRIVATE_KEY=”/tmp/private.key”; $PRIVATE_KEY_NOPASSWORD=”/tmp/private_nopassword.key”; //get the certificate file from pfx file $cmd=”openssl pkcs12 -clcerts -nokeys -in \”$pfx_file\” -out $CERT_FILE -passin pass:$password”; shell_exec($cmd); //get the ca-certificate file from pfx file $cmd=”openssl pkcs12 -cacerts -nokeys -in \”$pfx_file\” -out $CA_CERT_FILE -passin pass:$password”; shell_exec($cmd); ////get the private key from pfx file $cmd=”openssl pkcs12 -nocerts -in \”$pfx_file\” -out $PRIVATE_KEY -passin pass:$password -passout pass:$password”; shell_exec($cmd); if($remove_password) { //remove the password in private key $cmd=”openssl rsa -in $PRIVATE_KEY -out $PRIVATE_KEY_NOPASSWORD -passin pass:$password “; shell_exec($cmd); //put all 3 files into one file again $cmd=”cat $CERT_FILE $CA_CERT_FILE $PRIVATE_KEY_NOPASSWORD > $pem_file “; shell_exec($cmd); }else{ //put all 3 filesRead More →

Curl can provide us the following time report: time_namelookup time_redirect time_connect time_appconnect time_pretransfer time_starttransfer time_total To get these report time, you need to use the option -w , here is an example: curl -L –output /dev/null –silent –show-error –w ‘lookup: %{time_namelookup}\nconnect: %{time_connect}\nappconnect: %{time_appconnect}\npretransfer: %{time_pretransfer}\nredirect: %{time_redirect}\nstarttransfer: %{time_starttransfer}\ntotal: %{time_total}\n’ ‘google.com’ By default Smokeping Curl probe only fetch the load time – that is total_time – dns resolution. There are many occasions we have with DNS lookup, so we can’t find that issue. That’s why we have “AnotherCurl” probe , the big difference is the “write_out” option , AnotherCurl allows us to specify which the probe will report.Read More →

When you setup a cronjob file (/etc/cron.d/filename) , the file should include the path below: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/root/bin this is because if you don’t set the path, some command might not run well such as: service ( because it can’t find service run file location)Read More →

A sample function to use curl post data. $data=array() $data=array(); $data[“field1″]=”hello world”; $data[“user”]=”hello user”; curl_post($url,$data) function curl_post($url,$fields) { //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, ‘Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)’); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1); curl_setopt($ch,CURLOPT_POST, count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields); //some other users translate this array to string, but it will require you to convert some special chars in url such as & //execute post $result = curl_exec($ch); //close connection curl_close($ch); return $result; }Read More →

The service record for ldap and kerberos are used to identify LDAP and Kerberos server for a domain in Active Directory. When you configure some authentication method, it might ask you to specify the LDAP or Kerberos Server.  The simplest way to achieve this is using nslookup command. nslookup -type=srv _ldap._tcp.dc._msdcs.<domain> <dns server ip> nslookup -type=srv _kerberos._tcp.dc._msdcs.<domain> <dns server ip>Read More →

I built a customize alert, and there are some required fields on the form. User must provide data for these fields. When we build the alert with Addon Builder, the code generated by the builder only validate the required fields when the alert is triggered.  This will cause some problems because the user is not aware of this. We can’t use javascript in the html form, fortunately there is a solution, we can use the restmap.conf. This is the sample restmap.conf , you should put it in local\restmap.conf   The code below assume that your action name is “youractionname” and the required field is “title”Read More →

There will come a time when you need to start some scripts at startup, but you don’t want to to create it as a service. This is to help you to accomplish that. There are 2 methods: Using /etc/rc.local , this seems only working on Ubuntu 18.04 and older , from version 19, it seems not working. It’s like a bat file in windows, you create that file if it does not exist: nano /etc/rc.local sh /location to your script/script.sh chmod +x /etc/rc.local Using crontab -e , add this line: Read More →