When working on locked-down AIX systems where package installation isn't permitted, you can leverage several built-in options:
# Using Perl (commonly available on AIX)
perl -MLWP::Simple -e 'print get("https://example.com")'
# Using Python (if available)
python -c "import urllib2; print urllib2.urlopen('https://example.com').read()"
# Using ksh/bash native features
(echo "GET / HTTP/1.0"; echo "Host: example.com"; echo "") | openssl s_client -quiet -connect example.com:443
AIX includes several powerful tools that can handle HTTP requests:
# Using netcat (nc) if available
printf "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n" | nc -v example.com 443
# Using telnet with SSL (less secure)
openssl s_client -connect example.com:443 -crlf -quiet <
For environments with extreme restrictions, consider these creative solutions:
# Using Java (if JRE is present)
java -cp . HttpClientExample https://example.com
# Sample Java implementation:
import java.net.*;
import java.io.*;
public class HttpClientExample {
public static void main(String[] args) throws Exception {
URL url = new URL(args[0]);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
try (BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()))) {
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
}
}
}
If you only need to verify connectivity rather than full HTTP response:
# Basic port connectivity test
timeout 5 bash -c "cat < /dev/null > /dev/tcp/example.com/443" && echo "Connected" || echo "Failed"
# Using ping (won't test HTTPS specifically)
ping -c 1 example.com
During infrastructure troubleshooting, we often encounter locked-down AIX systems where standard tools like curl and wget aren't available. In change-controlled environments, getting approval for new package installations can take weeks. Here are several built-in alternatives for performing HTTPS GET requests without installing additional software.
1. Perl with LWP (often pre-installed on AIX):
perl -MLWP::Simple -e 'print get("https://example.com")'
2. Python urllib (if Python is available):
python -c 'import urllib2; print urllib2.urlopen("https://example.com").read()'
3. Netcat + OpenSSL (for raw socket testing):
(echo -e "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n"; sleep 1) | openssl s_client -connect example.com:443 -ign_eof
While not HTTPS, basic HTTP connectivity can be verified with telnet:
telnet example.com 80
GET / HTTP/1.1
Host: example.com
Press Enter twice after the Host header. For HTTPS simulation on port 443:
openssl s_client -connect example.com:443 -crlf -quiet
GET / HTTP/1.1
Host: example.com
For systems with IBM's toolsets installed:
1. Using ncat (if installed):
ncat --ssl example.com 443 << EOF
GET / HTTP/1.1
Host: example.com
EOF
2. IBM HTTP Client: Some AIX installations include the IBM HTTP Client which can be invoked via Java:
java -cp /usr/IBM/HTTPServer/java/ibmjsse.jar com.ibm.net.ssl.www.protocol.http.HttpClient https://example.com
In environments where even scripting languages are restricted:
1. Using ksh/bash network redirection:
exec 3<>/dev/tcp/example.com/443
echo -e "GET / HTTP/1.1\r\nHost: example.com\r\nConnection: close\r\n\r\n" >&3
cat <&3
2. ftp with SSL support: Some AIX ftp implementations support SSL:
ftp -z ssl example.com 443
Remember that these methods vary in their SSL/TLS support and may not handle modern HTTPS requirements like SNI or strict certificate validation.