The following is a list of very common programming languages and why a Pentester/Hacker should be at the very least familiar with them:
- Bash - Using linux, I'd wager the most important language to be proficient in.
- Ruby - Many security tools are written in Ruby, extending metasploit, exploit dev, understanding/exploiting Rails vulns. Overall a very enjoyable language to program in.
- Python - Many security tools are written in python, extending veil/impacket, exploit dev, lots of RE/Forensics tools are written in python, huge and active community to build upon.
- C++ - Custom windows malware writing, gives you more direct access to the windows API
- PHP - crap ton of webapps/professional appliances/general web stuff is written in PHP
- Java - Almost every single organization runs java somewhere. Java web apps, apache tomcat, Weblogic, any java app server, java RPC protocols. LOTS of vulnerabilities introduced because of java apps.
- C - Custom malware writing (in general), several security tools written in C, driver/kernel hacking
- Perl - Make yourself seem way older than you actually are. haha, jk. no really you don't need to learn perl.
Other programming like things:
- Object Oriented Programming - Important for source code analysis and writing more powerful tools
- Programming Patterns - Certain programming patterns are not intuitive at all. Important to know when you are debugging other's code or doing source code analysis.
- HTML - Any place you'd have HTML injection or trying to get custom XSS/ or other browser centric vulns to pop
- XML - data storage, API data transfer format, SOAP, XXE injection
- JSON - Other than XML, most often used API format
- SQL - SQLi, intercepting SQL traffic
This list is by no means exhaustive or comprehensive, it's just typically the languages you'd most often encounter on pentests, exploit dev, or reverse engineering. If you can think of other uses for the languages or another language I missed, let me know.