Cyber security

Creating a Linux password hash Like you find in /etc/shadow. mkpasswd --method=sha-512 --salt=Kf0TqvhN Search tools Use different search engines Banner grab httrack inspy metagoofil intitle:“index of” Infosec websites Cracking a KeePass2 master password with John the Ripper john <(keepass2john easy.kdbx) Considerations Language vulnerabilities Common cyber attacks Tor Crypto attacks - frequency analysis Data encryption standard AES advanced encryption standard Substitution permutation network Kali Linux Vulnerability research with reverse engineering, penetration testing and ethical hacking Low level Linux programming and/or comprehensive knowledge in operating system security and associated network/platform design, hardening and deployment. [Read More]

The magnitude of it all

The units you should be aware of

In 2014 Randall Munroe estimated that Google stores 10 exabytes of data across all of its operations. See list of SI prefixes. If CPUs are topping out at gigahertz then single operations aren’t going to subceed the order of nanoseconds. 1 000 kilo | milli .001 1 000 000 mega | micro .000 001 1 000 000 000 giga | nano .000 000 001 1 000 000 000 000 tera | pico . [Read More]


SQL “Structured Query Language” SQL - relational NoSQL - non-relational Tables / schema Humongous data, collections, documents, duplication of data Structured Semi/no structure, flexible Relations Less dependence on relations, quick reads Atomic Eventually consistent Monolithic Distributed SQL MySql, Oracle, Sqlite, Postgres, MS-SQL, Amazon Aurora (part of RDS). NoSQL MongoDB, BigTable, Redis, RavenDb, Cassandra, Hbase, Neo4j, CouchDb, Amazon DynamoDB. [Read More]


Single responsibility principle A class should have only a single responsibility (i.e. changes to only one part of the software’s specification should be able to affect the specification of the class). A class should have only one reason to change. Separate GUI and the business logic. Low coupling, high cohesion. Open/closed principle Software entities should be open for extension, but closed for modification. However, realistically you don’t know which bits need to be extensible. [Read More]

STL containers Sequence Containers array vector deque forward_list list Container Adapters stack queue priority_queue Associative Containers set map multiset multimap Unordered Associative Containers unordered_set unordered_multiset unordered_map unordered_multimap Features multiset, set and map are typically implemented as binary search trees. Forward lists are sequence containers that allow constant time insert and erase operations anywhere within the sequence. map is generally slower than unordered_map containers to access individual elements by their key, but it allows the direct iteration on subsets based on their order. [Read More]


Layers and protocols

Please Do Not Take Salami Pizza Away Comparison of OSI and TCP/IP models. OSI TCP/IP Protocol Data Unit Protocols Example Hardware example Application Application Files/data Facebook Application layer gateway (packet inspection) Presentation ssh Encryption Session http, telnet Login Transport Transport Segments/datagrams TCP, UDP TCP Firewall (port number) Network Internet Packets IP, ICMP, ARP ping Router, layer 3 switch Datalink Network Frames/bits fibre, Ethernet, Wi-Fi ARP Bridge, switch (forward or not forward) Physical Wi-Fi Repeater, hub (multiport repeater) Additionally ICMP: ping, sends echo request. [Read More]


Argument dependent lookup

Why does this compile? A one-liner to print a vector to stdout. But why does this compile without the namespace std::? #include <iostream> #include <vector> #include <iterator> int main() { const std::vector<int> v{1, 2, 3, 4, 5}; copy(cbegin(v), cend(v), std::ostream_iterator<int>(std::cout, "\n")); } Run the code on Compiler Explorer, Jason Turner on YouTube and ADL on Wikipedia. Note: C++14 is the default for the latest GCC (9.2). Exercise Propose some other examples of ADL. [Read More]

Coding tests

Techniques to up your interview game

Listen - usually all of the information in the question is useful. Example - make examples larger, avoid special cases. Brute force - better to have brute force than nothing at all, don’t necessarily code it, maybe just state the runtime. Optimise. Walk through your algorithm. Code. Test - use small test cases, then edge cases. Analyse and optimise - check for loops, maths, walk through the code, not the algorithm. [Read More]

Imagine you're a browser...

Technologies and protocols

An example of technologies encountered when a browser requests a page from a server. In this case the browser is running on a laptop connected by Wi-Fi. Forming a request User types a URL into the browser: Host performs DNS resolution to convert the URL into an IP address (the web server) The DNS server (and host IP) could be set manually but it will probably be part of a DHCP offer The application (browser) attempts a TCP connection with the server IP If no protocol is specified (http, https, ftp) the browser will default to 80 The browser must now work out how to reach the server The netmask is ANDed with the host IP address, if they’re on the same network then the request can be emitted immediately Otherwise, the host must send the packet via the default gateway (also configured by DHCP) The information makes its way down the TCP stack Layer two adds the MAC header Frame is transmitted between devices Frame is encrypted as it is transmitted through the air At the gateway the request makes its way back up to the TCP layer where it can be forwarded to the next gateway The browser will probably be running from a private network so the router must translate the local to the WAN network (NAT) Reaching the server Upon reaching the destination the server will probably send a redirect to the HTTPS version of the website (. [Read More]


The conventional wisdom when to use a linked list over contiguous storage hasn’t applied for years: you have to test. If everything is in a cache a vector might outperform a linked list for insertion. Algorithm patterns Brute Force Divide and Conquer Decrease and Conquer The Greedy Method Dynamic Programming Backtracking Branch and Bound Hill Climbing Particle Swarm Optimisation Las Vegas Monte Carlo Reduction (Transformation) Preprocessing See algorithm patterns. [Read More]