networking

#define networking: \ I------------------------------------------------------------------------------------------------------------------------\ I------------------------------------------------------------------------------------------------------------------------\ I------------------------------------------------------------------------------------------------------------------------\ I /$$ /$$ /$$ /$$ /$$ \ I | $$$ | $$ | $$ Networking | $$ |__/ \ I | $$$$| $$ /$$$$$$ /$$$$$$ /$$ /$$ /$$ /$$$$$$ /$$$$$$ | $$ /$$ /$$ /$$$$$$$ /$$$$$$ \ I | $$ $$ $$ /$$__ $$|_ $$_/ | $$ | $$ | $$ /$$__ $$ /$$__ $$| $$ /$$/| $$| $$__ $$ /$$__ $$ \ I | $$ $$$$| $$$$$$$$ | $$ | $$ | $$ | $$| $$ \ $$| $$ \__/| $$$$$$/ | $$| $$ \ $$| $$ \ $$ \ I | $$\ $$$| $$_____/ | $$ /$$| $$ | $$ | $$| $$ | $$| $$ | $$_ $$ | $$| $$ | $$| $$ | $$ \ I | $$ \ $$| $$$$$$$ | $$$$/| $$$$$/$$$$/| $$$$$$/| $$ | $$ \ $$| $$| $$ | $$| $$$$$$$ \ I |__/ \__/ \_______/ \___/ \_____/\___/ \______/ |__/ |__/ \__/|__/|__/ |__/ \____ $$ \ I /$$ \ $$ \ I | $$$$$$/ \ I \______/ \ I------------------------------------------------------------------------------------------------------------------------\ I------------------------------------------------------------------------------------------------------------------------\ I------------------------------------------------------------------------------------------------------------------------I https://beej.us/guide/bgnet/html/split/index.html Computer networks by Andrew S. Tannenbaum Cisco Networking Essentials by Troy McMillan # Joshua Moon on health of the Internet https://madattheinternet.substack.com/p/where-the-sidewalk-ends-the-death Size: Sneakernet:"manual automation" • legacy term • the process of transferring data by coping to an external drive and delivering it by foot LAN:"Local Area Network" WLAN is a common abbreviation which can cause confusion between LAN/WAN, however it stands for "Wireless LAN" WAN:"Wide Area Network" • or internet ("INTERconnected NETworks") (with a lower case 'i') • collection of LANs • network of networks • there is no strict line between LAN and WAN • the usage of the terms could be context dependent / relativistic Intranet: • private network • only accessible by authorized personnel { networking system of an university; segregated 3 letter agency networks } Extranet: • outsider equipment which accesses an intranet { VPN software; computer of employee logging in remotely } Internet ┏━━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━━ ━┓ ? ┃ ┃ ? ┌─────────┤ <...>'s Network ├─────────┐ │┌┤Extranet├┐┃┌──────┤Intranet├──────┐│ ┃ ││ │ │ ___ ││ ? ││ __│┃│ / \ _____ ││ ┃ ││ .---88---| XXX |---I 0x0 I ││ ││ l_ ""│┃│ \___/ '''''' ││ ┃ ? ││ |0| │ │ |-------------. ││ ││ ^^^ │┃│ l_ l_ l_ l_ ││ ┃ ? ││ │ │ |0| |0| |0| |0| ││ ││ │┃│ ^^^ ^^^ ^^^ ^^^ ││ ┃ │└──────────┘ └──────────────────────┘│ ┗━ ━━ ━━ ━━ ━━ ━━ ━━ ━━│ ━━ ━━ ━━━┛ │ └─────────────────────────────────────┘ Internet: • strictly capital 'I' • global WAN VPN: //write a good rant; ?!; also move"Virtual Private Network" ○ vpn technologies ○ layer 5-7 • SSH • SSL ○ layer 3-4 • GRE • PPTP • L2TP • MPLS • IPSec • MPPE ○ layer 1-2 • link-layer encryption DMZ:"Demilitarized Zone" (named after the political expression) • an isolated network for security purposes Hierarchy: Peer_to_Peer: • all nodes are equal — Pros: • cheap • no server required; easy to set up • no centralization — Cons: • not scalable Clien_server: • a server is a computer existing to perform networking tasks and thereby serve clients; or by another deffinition a computer that has a resource which it makes accessable to other computers • all computers in a network which are not servers are clients • allows for usage of a mainframe, which is strong centrall computer sharing computing resources across the network — Pros: • scalable — Cons: • centralized • expensive Transmission: unicast : a single host sending information to another host; one-to-one multicast : a single host sending information to multiple (, but not all) other hosts; one-to-some broadcast : a single host sending informaion to all other hosts on the network; one-to-many anycast : a single host sending information to a single interface routed the neerest Topology: • the form of the physical connection of the devices of a network Mesh: • every computer is connected to every other computer by an individual cable ___ ___ .^ .^| .^ .^| .^ .^ | .^ .^ | |‾‾| | |‾‾| | |==| | ──── |==| | |^*| .^ |^*| .^ |__|.^ |__|.^ │"-. ." │ │ "-. ." │ │ "-." │ │___.-" ""--.. │___ .^ .^| '.^ .^| .^ .^ | .^ .^ | |‾‾| | |‾‾| | |==| | |==| | |^*| .^ ──── |^*| .^ |__|.^ |__|.^ Bus: ___ ___ ___ ___ .^ .^| .^ .^| .^ .^| .^ .^| .^ .^ | .^ .^ | .^ .^ | .^ .^ | |‾‾| | |‾‾| | |‾‾| | |‾‾| | |==| | |==| | |==| | |==| | |^*| .^ |^*| .^ |^*| .^ |^*| .^ Terminator |__|.^ |__|.^ |__|.^ |__|.^ Terminator ░░░ │ │ │ │ ░░░ ░░░──────┴───────────────┴───────────────┴───────────────┴─────────░░░ ░░░ <------+------> ░░░ • computers are connected to a single backbone cable • data travels both ways trying to find the right destination • as all trafick is handled by the same cable, overwhelming it results in network-wide performance degradation • if the backbone gets damaged the whole network goes down Ring: ___ ___ ___ ___ .^ .^| .^ .^| .^ .^| .^ .^| _______ .^ .^ | .^ .^ | .^ .^ | .^ .^ | | ___ 0| |‾‾| | |‾‾| | |‾‾| | |‾‾| | |[_-_]_ | |==| | ── |==| | ── |==| | ── |==| | |[_____]| |^*| .^ |^*| .^ |^*| .^ |^*| .^ |[_____]| |__|.^ |__|.^ |__|.^ |__|.^ |[====o]| ┌┘ └┐ |[_.--_]| │ ├───────| F :| └─────────────────────────────────────────────────┘ |______:| Star: ___ ___ .^ .^| .^ .^| .^ .^ | .^ .^ | |‾‾| | |‾‾| | |==| | |==| | |^*| .^ |^*| .^ |__|.^ |__|.^ ___ ╲ ╱ ___ .^ .^| ╲ ╱ .^ .^| .^ .^ | ╲ ╱ .^ .^ | |‾‾| | .^‾‾‾‾‾‾‾‾‾‾. |‾‾| | |==| | ─────── I_________.^| ────── |==| | |^*| .^ | #* 00 ~~ |.^ |^*| .^ |__|.^ ‾‾‾‾‾‾‾‾‾‾^╲ |__|.^ _╱_ ╲ ___ .^ .^| .^ .^| .^ .^ | ^ .^ | |‾‾| | |‾‾| | |==| | |==| | |^*| .^ |^*| .^ |__|.^ |__|.^ • by far to most common • all devices are connected to central device { hub; router; etc. } • its the middle devices responsibility deliver data to the correct machine Hybrid: • a combination of any of the ABOVE • sorry, I'm not drawing one Networking_Hardware: Repeater: • a device which uppon receving data, echos it forward • used to reset the data strenght which was lowered due to attenuation • dumb • minecraft is cooler than i thought Hub: • or multiport repeaters • the most minimalistic device which allows for implementing a star topology • dumb • middle piece to which devices connect • uppon receving a frame it echos it back to all of its occupied ports except the one it has recieved it from Bridge: • similar to a hub • learns the MAC addresses of the connected devices and echos only to the correct port • makes forwarding decissions with software • not so dumb • great help with collisions • not all that popular in physical form, but virtualized quite often {in routers} • can be used to map many physical ports to a single IP Switch: • does everything a bride can • makes forwarding decission with dedicated chips (meaning less overhead) • has the ability to avoide loops (when a frame cant find its target and therefor it takes infinite laps around, being forwarded endlessly) ○ forwarding methods • some switch-es can only perform one of the BELOW, some can be configured between methods — store-and-forward: • reads the whole frame and checks the FCS • corrupted packages doesnt get forwarded • slow — fragment-free: • the first 64 bits are read • packages corrupted by collisions are not forwarded • mild spead — cut-through: • only the MAC addresses are read before forwarding • fast • corrupted packages are forwarded Router: • allows multiple networks to be connected • resposible for forwarding a frame on the correct route to reach its destination in the shortest possible way • inteligent as fuck ○ common_router_operating_systems: • CatOS • Cisco IOS • Linux {openWRT} • usually, their operating system gets loaded to memory on start up for performence Routing_tables: • the internal information that a router uses to make routing decesions ○ population methods • all are symbolised by a single letter, which is usually written to the left of network id — C; having a direct connection (auto) — S; being manually configured (static) — R; learned from another router by dynamic routing protocol (auto) — Exterior routing protocols — Interior routing protocols Multilayer_Switches:"MLS" • combination of a router and a switch • by mashing the two roles together, performs both jobs faster than an individual router and switch could

networking_models

#define networking_models:: \ I---------------------------------------\ I ___ ___ _ _ \ I | \/ | | | | | \ I | . . | ___ __| | ___| |___ \ I | |\/| |/ _ \ / _` |/ _ \ / __| \ I | | | | (_) | (_| | __/ \__ \ \ I \_| |_/\___/ \__,_|\___|_|___/ \ I---------------------------------------I • networking is so complex that for human sanaties sake its broken up into layers • each layer has its own API with which its the layer BELOW and ABOVE can communicate with OSI:"Open Systems Interaction" • widely recognized layering model • created by ISO • YEARS OF TEACHING yet NO REAL-WORLD USE FOUND — layers: +--------------+ 7 | Application | +--------------+ 6 | Presentation | +--------------+ 5 | Session | +--------------+ 4 | Transport | +--------------+ 3 | Network | +--------------+ 2 | Data-Link | +--------------+ 1 | Physical | +--------------+ "Please Do Not Throw Sausage Pizza Away" // (mnemonic) h a e r e r p y t t a s e p s a w n s s l i - o s i e i c L r p o n c a i k o n t a l n r a t k t t i i o o n n IPS:"Internet Protocol Suite""TCP/IP model" • originally created by the (((USA Department of Defense))) IPS +-------------+ | | | | | Application | 4 <----- HTTP; FTP; SMTP; etc. | | | | +-------------+ | Transport | 3 <----- TCP; UDP +-------------+ | Internet | 2 <----- IP +-------------+ | Network | | Access | 1 <----- OS kernels; physical medium | | +-------------+ — IANA ("Internet Assigned Numbers Authority") • the organization responsible for assinging and keeping track of IPs and domains • its a literal world mafia Comperassion_to_OSI: OSI IPS +--------------+********+-------------+ 7 | Application | | | <----- HTTP; FTP; SMTP; etc. +--------------+ | | 6 | Presentation | | Application | 4 <----- Encryption; Compression; etc. +--------------+ | | 5 | Session | | | <----- Connection of source and destination +--------------+********+-------------+ 4 | Transport | | Transport | 3 <----- Identification of protocol and port +--------------+********+-------------+ 3 | Network | | Internet | 2 <----- Indetification of ip address +--------------+********+-------------+ 2 | Data-Link | | Network | <----- Identification of MAC adress +--------------+ | Access | 1 1 | Physical | | | <----- Medium allowing for data exchange +--------------+ +-------------+ Protocol_Data_Units:"PDU" — at each layer the individual data units have different names • Data • Segment • Packet • Frame Layer: PDU name ───────────────────────────────────────────────────────────────────────────────────────────────────── +-------------+-------------+ | Application | Data | Application: Data | Header | | +-------------+-------------+ ───────────────────────────────────────────────────────────────────────────────────────────────────── +-------------+-------------+ | Transport | Payload | Transport: Segments | Header | | +-------------+-------------+ ───────────────────────────────────────────────────────────────────────────────────────────────────── +-------------+-------------+-------------+ | Network | Transport | Payload | Internet: Packets | Header | Header | | +-------------+-------------+-------------+ ───────────────────────────────────────────────────────────────────────────────────────────────────── +-------------+-------------+-------------+-------------+-------------+ | Frame | Network | Transport | Payload | Frame | Network Access: Frames | Header | Header | Header | | Trailer | Sometimes also refered +-------------+-------------+-------------+-------------+-------------+ to as Packets ───────────────────────────────────────────────────────────────────────────────────────────────────── ?!: — network access • a frame trailer is added containing a frame check sequance • a frame check sequance (FCS) contains section meta-data information used to check frame integrity // -------------------- URL: // ?!; move"Uniform Resource Locator" • naming scheme for internet resources | Protocol | Authentication | Server | Path | { Complete URL scheme: <protocol>://<name>:<password>@<domain>:<port>/<path> } { // Average site link | | | | https://4channel.org/g/catalog | | | | Protocol: https Authentication: None Server:_ 4channel.org // NOTE: in the example (and in most real file cases) the server is identified by a domain; see ../DNS Path: g/catalog } NAT:"Network Address Traslation" • by mapping internal IPs to ports, it allows for reserving a single public IP to a LAN • typically performed by all routers • saved the net from running out of IPs ridicilously fast SNAT:"Source NAT" • mostly applied to out going packets DNAT:"Destination NAT" • mostly applied to inbound packets

networking_protocols

#define networking_protocols:: \ I-------------------------------------------------\ I ______ _ _ \ I | ___ \ | | | | \ I | |_/ / __ ___ | |_ ___ ___ ___ | |___ \ I | __/ '__/ _ \| __/ _ \ / __/ _ \| / __| \ I | | | | | (_) | || (_) | (_| (_) | \__ \ \ I \_| |_| \___/ \__\___/ \___\___/|_|___/ \ I-------------------------------------------------I "\ ___ _ _ _ _ \ | _ \ |_ _ _ __(_)__ __ _| | | | __ _ _ _ ___ _ _ \ | _/ ' \ || (_-< / _/ _` | | | |__/ _` | || / -_) '_| \ |_| |_||_\_, /__/_\__\__,_|_| |____\__,_|\_, \___|_| \ |__/ |__/ \ " Multiplexing: TDM:"Time Division Multiplexing" • bandwidth is divided into time slots • machines and applications take turns in communicating FDM:"Frequency Division Multiplexing" • the mediums frequency spectrum is divided into non-overlapping frequency bands "\ ___ _ _ _ \ |_ _|_ _| |_ ___ _ _ ___| |_ | | __ _ _ _ ___ _ _ \ | || ' \ _/ -_) ' \/ -_) _| | |__/ _` | || / -_) '_| \ |___|_||_\__\___|_||_\___|\__| |____\__,_|\_, \___|_| \ |__/ \ " ARP:"Address Resolution Protocol" MAC_address: // ?!; move"Media Access Control" • or hardware address, physical address, adapter address • not related Apple©™ • stored in the NIC (or mobo nowdays) • unchangeably burnt into the silicone of ones machine • globally unique id • can be forged • visible only to ones local network IP:"Internet Protocol" • a system of assigning unique addresses to computers • necessery for device identification ○ versions — IPv4: • 32 bit — writen in groups of decimal octets x.x.x.x • 'x' being an unsigned char (0-255) • leading 0-s are omited { 123.45.178.9 } • 4.294.967.296 possibles addresses, some are reserved however ○ reserved addresses 0.0.0.0 255.255.255.255 — network id: • all host bits are 0-s — broadcast address: • all host bits are 1-s (resulting in octet holding the value of 255) — Private addresses: — 10.x.x.x — 172.16.0.0-172.31.255.255 — 192.168.x.x — 127.x.x.x range: • loopback address • for testing • any of these address can be success fully pinged with a working NIC, and a working TPC/IP installation • every out going packet is return-ed as an inbound packet — 127.0.0.1: • most common value License_classes: • A-E • practically obsolite +-------+---------------+--------+------+--------------------+-----------------+ | Class | Address Range | Prefix | Mask | Number of Networks | Number of Hosts | +-------+---------------+--------+------+--------------------+-----------------+ | A | 1-126.x.x.x | 0 | 8 | 256 | 16.777.214 | | B | 128-191.x.x.x | 10 | 16 | 65.536 | 65.534 | | C | 192-223.x.x.x | 110 | 24 | 16.777.216 | 254 | | D | 224-239.x.x.x | 1110 | N/A | N/A | N/A | | E | 240-255.x.x.x | 1111 | N/A | N/A | N/A | +-------+---------------+--------+------+--------------------+-----------------+ A: • assigned to used to be large networks { IBM; HP; Apple; DoD } B: • assigned to used to be medium networks { Ford; MIT; GE } C: • assigned to used to be small networks { insignificantly large companies } D: • multicast addresses E: • experimental or future use • not assigned CIDR:"Classless Inter Domain Routing" — Header: <-- 32 bits --> +--------------+--------------+--------------+--------------------------------------------+ | Version | IHL | TOS | Total length | +--------------------------------------------+--------------------+-----------------------+ | Identification | Flags | Fragment Offset | +---------------------+----------------------+--------------------------------------------+ | Time to live | Protocol | Header Checksum | +---------------------+----------------------+--------------------------------------------+ | Source Address | +-----------------------------------------------------------------------------------------+ | Destination Address | +--------------------------------------------+--------------------------------------------+ | Options | Padding | +--------------------------------------------+--------------------------------------------+ \ Data \ / (Variable size) / +-----------------------------------------------------------------------------------------+ — IPv6: • 128 bit • forced IPsec — written in 8 groups of 4 hex numbers separated by colons . xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx • the first 4 sections are the host partion • the last 4 sections are the network partion { 2001:0db8:85a3:0000:0000:8a2e:0370:7334 } — link-local: • always start with fe80: Link-local IPv6 addresses are used as part of the IPv6 network auto-configuration process. Instead of getting an address via DHCP, a NIC will hop on the network with a link-local IPv6 address and with this will have the ability to do further configuration automatically (soliciting neighbors, router, et cetera). This link-local IPv6 is infered from the NIC’s mac address. A mac address is 48 bits, an IPv6 address is 128 bits. Here’s the conversion process step by step: 1. take the mac address { 52:74:f2:b1:a8:7f } 2. throw ff:fe in the middle { 52:74:f2:ff:fe:b1:a8:7f } 3. reformat to IPv6 notation { 5274:f2ff:feb1:a87f } 4. convert the first octet from hexadecimal to binary { 52 -> 01010010 } 5. invert the bit at index 6 (counting from 0) { 01010010 -> 01010000 } 6. convert octet back to hexadecimal { 01010000 -> 50 } 7. replace first octet with newly calculated one { 5074:f2ff:feb1:a87f } 8. prepend the link-local prefix { fe80::5074:f2ff:feb1:a87f } done! — unique local address: • always starts with fec0: — global: • always starts with 2000: ○ reserved addresses 0:0:0:0:0:0:0:0 or :: : default address of any machine not assigned a unique ipv6 0:0:0:0:0:0:0:1 or ::1 : loopback address (127.0.0.1 in ipv4) . FF00:[...] : multicast range Subnetting: • necessery for fast data delivery • scalable with dismissible performance impact Subnet_mask: • a number used to identify the network part of an ip • same length • const string of 1-s starting from the left side continue-ing with a const string of 0-s — standard subnet masks: • class A: 255.0.0.0 • class B: 255.255.0.0 • class C: 255.255.255.0 — CIDR notation • "Classless Inter-Domain Routing NOTATION" • a subnet written simply by posponing a slash and the number of true bits to an ip { ip: 172.18.5.5 . mask: 255.255.255.240 172.18.5.5/28 } VLSM:"Variable length Subnet Mask" ROUTING: • routing tables • if the routing tables are configured manually, its called static routing • if the routing tables are configured auto, its called dynamic routing ○ protocols for dynamic tables • RIP • OSPF • EIGRP ○ algorithms to find the shortest path • Dijkstra's • Bellman-Ford • link-state • routing is dependent on the shortest know path (dependent on hop count) and the quality of the connection CABLES: COAX: • anchient Fiber_optic: • replacement for COAX • gigabit capable Ethernet: — T568A Green-White Green Orange-White Blue Blue-White Orange Brown-White Brown — T568B Orange-White Orange Green-White Blue Blue-White Green Brown-White Brown "\ _____ _ _ \ |_ _| _ __ _ _ _ ____ __ ___ _ _| |_ | | __ _ _ _ ___ _ _ \ | || '_/ _` | ' \(_-< '_ \/ _ \ '_| _| | |__/ _` | || / -_) '_| \ |_||_| \__,_|_||_/__/ .__/\___/_| \__| |____\__,_|\_, \___|_| \ |_| |__/ \ " TCP:"Transmission Control Protocol" • unicast • considerable overhead • reliable • has sequancing (numbers in the packets so that they may always be put into order) • implements windowing; meaning aknowledgements are sent back after arbitrary amounts of data has been transmited; the process of changing the window site is called flowcontrol and is implemented in such a way to allow for good performance while minimizing the number of packets that must be resent — Three-Way Handsake: ,---------, 044444444444440 044444444444440 ," ,"| ___________ 1 1 1 1 ," Kevin ," | ( |.---------.| 1 1 1 LISTENING 1 ," Lam ," | || #jgs_ || 1 1 ------SYN-----> 1 1 +---------+ | || || 1 SYN_SENT 1 1 1 | -==----'| | || || 1 1 1 1 | | | |'---------'| 1 1 1 SYN_RCVD 1 |`---= | | `)__ ____(' 1 1 <---SYN-ACK---- 1 1 |==== ooo | ; [=== -- o ]--. 1 ESTABLISHED 1 1 1 |(((( [33]| ,^ __'---------'__ \ 1 1 ------ACK-----> 1 1 |(((( | ,^ )))))))) [::::::::::: :::] ) 1 1 1 ESTABLISHED 1 | |,^ `""""""""'""""`/T\ 1 1 1 1 +---------+ Client \_/ 044444444444440 044444444444440 Server SYN : synchronization request ACK : synchronization request acknowledgment — Header: <-- 32 bits --> +--------------------------------------------+--------------------------------------------+ | Source Port | Destination Port | +--------------------------------------------+--------------------------------------------+ | Sequnece Number | +-----------------------------------------------------------------------------------------+ | Acknowledgment Number | +--------------+--------------+--------------+--------------------------------------------+ | Data Offset | Reserved (6) | Flags (6) | Window | +--------------+--------------+--------------+--------------------------------------------+ | Options and Padding | +--------------------------------------------+--------------------------------------------+ \ Data \ / (Variable size) / +-----------------------------------------------------------------------------------------+ UDP:"User Datagram Protocol" • multi- or broadcast • minimal overheap • fast — Header: <-- 32 bits --> +--------------------------------------------+--------------------------------------------+ | Source Port | Destination Port | +--------------------------------------------+--------------------------------------------+ | length | Checksum | +--------------------------------------------+--------------------------------------------+ \ Data \ / (Variable size) / +-----------------------------------------------------------------------------------------+ "\ _ _ _ _ _ _ \ /_\ _ __ _ __| (_)__ __ _| |_(_)___ _ _ | | __ _ _ _ ___ _ _ \ / _ \| '_ \ '_ \ | / _/ _` | _| / _ \ ' \ | |__/ _` | || / -_) '_| \ /_/ \_\ .__/ .__/_|_\__\__,_|\__|_\___/_||_| |____\__,_|\_, \___|_| \ |_| |_| |__/ \ " DHCP:"Dynamic Host Configuration Protocol" • auto assigns ip addresses — DHCP process: 1. DHCPDiscover ip address requst ....... by the đ_Client_đ 2. DHCPOffer .. ip address offer ........ by the đ_Server_đ 3. DHCPRequest ip address selection .... by the đ_Client_đ 4. DHCPAck .... ip address acknowledgment by the đ_Server_đ SSH:"Secure SHell" protocol • "transport layer through application layer"; this is where you can really see the OSI model break down; ssh requires "any 8-bit clean, binary-transparent transport" which is usually TCL/IP, but it also requires an application using the protocol it sets up • IANA registered port 22 — process of establishing an ssh connection; • note based on RFC 4253 and the sshd manual; the host key authentication does not seem to be part of the ssh psecification, but it says: "The server MAY send other lines of data before sending the version string." and the manual documents: "Whenever a client connects, the daemon responds with its public hostkey." so it seems reasonable to assume thats where it happens 04444444444444444444440 Connection Request 044444444444444440 1 1 ---------------------------> 1 1 1 ___________ 1 Transport connection 1 ,---------, 1 1 |.---------.| 1 established {TCP} 1 ," KL ,"| 1 1 || #jgs_ || 1 <==========================> 1 +---------+ | 1 1 || || 1 Host Key 1 | -==----'| | 1 1 || || 1 <--------------------------- 1 | | | 1 1 |'---------'( 1 Version Exchange 1 |`---= | | 1 1 `)__ ____(' 1 <==========================> 1 |==== ooo | | 1 1 [=== -- o ]--. 1 Key Negotiation 1 |(((( [33]| | 1 1 __'---------)__ \ 1 <==========================> 1 |(((( | ; 1 ))))))) 1 [::::::::::: :::] ) 1 Service Request 1 | |,^ 1 1 `""""""""'""""`/T\ 1 ---------------------------> 1 +---------+ 1 1 Client \_/ 1 Authentication 1 Server 1 1 1 <==========================> 1 1 1 1 Service 1 1 04444444444444444444440 <==========================> 044444444444444440

network_applications

#define network_applications:: \ I---------------------------------------------------------------\ I ___ _ _ _ _ \ I / _ \ | (_) | | (_) \ I / /_\ \_ __ _ __ | |_ ___ __ _| |_ _ ___ _ __ ___ \ I | _ | '_ \| '_ \| | |/ __/ _` | __| |/ _ \| '_ \/ __| \ I | | | | |_) | |_) | | | (_| (_| | |_| | (_) | | | \__ \ \ I \_| |_/ .__/| .__/|_|_|\___\__,_|\__|_|\___/|_| |_|___/ \ I | | | | \ I |_| |_| \ I---------------------------------------------------------------I Apache: apache2 daemon Files: /etc/apache2/ : config directory /var/log/apache2/ : log directory Programs: apache2ctl [options] : responsible for cli administration of the apache2 daemon — S : print relevant information about the running instance Lighttpd: • minimalist webserver • can easily be run in the foregroup • if one more source spells out how its pronounced im commiting homicide Files: /etc/lighttpd/ : config directory . ### Lighttpd relative, cgi example ### — lighttpd.conf { server.modules = ( "mod_cgi", "mod_rewrite" ) server.document-root = var.CWD server.port = 5050 url.rewrite-once = ( "^/$" => "/ether.pl" ) cgi.assign = ( ".pl" => "/usr/bin/perl" ) } — ether.pl: { #!/usr/bin/perl print "Content-type: text/plain\n\n"; print "Hello, World from ether.pl!"; } $ lighttpd -D -f ./lighttpd.conf • and it just werks™ # Samba: samba daemon // smbd"Server (A) Message (A) Block"; one of the few dictionary words that can be formed using "SMB" Files: /etc/samba/ : config dir └── smb.cfg : main config file Configuration: • ini format, but key names may contain spaces Sections: [global] : generic server config [homes] : used for creating shared resourced on the fly to users not configured explicit-ly [printers] : used for printers [<...>] : shared resource named <...> Supported_protocols: CORE COREPLUS LANMAN1 LANMAN2 NT1 SMB2_02 SMB2_10 SMB3_00 SMB3_02 SMB3_11 SMB2_FF Macros: • expanded inside key values %R : protocol in use (see BELOW) %T : current date %t : current date (YYYYYmmdd_HHMMSS) %w : winbind separator %S : service name %P : service root directory %u : username of the service %g : primary group name of %u %H : home directory of the user given by %u %$(ENVVAR) : value of the environment variable ENVVAR server: %h : hostname %d : pid %L : NetBIOS name %N : %L client: %a : OS %U : requested username %G : group name of %U %D : domain or workgroup %I : IP %J : %I where colons/dots are replaced by underscores %i : local IP %j : %i where colons/dots are replaced by underscores %M : DNS %m : NetBIOS name; not available when Samba listens on port 445 Options: admin users = <user>* : allow root access for <user>* browsable = [yes|no] : whether to allow directory listing create mask = <mask> : UNIX permission mask to AND with new files directory mask = <mask> : UNIX permission mask to AND with new dirs dns port = <port> follow symlinks = [yes|no] public = [yes|no] : whether to allow guest logins guest only = [yes|no] : whether to only allow guest logins allow hosts = <host>* : whitelist of hosts; deny hosts = <host>* : blacklist of hosts include = <path> : C style include path = <path> : path to which the user is given access to root = <path=""> : path to chroot to at launch; requires mirroring /etc/passwd and configured scripts username map = <path> : specifies a username map file to use writable = [yes|no] : whether to allow file writting Name_mangling: • translating file names so systems not prepared to understand some names may still do case sensitive = [yes|no|auto] default case = [upper|lower] Identity_mapping: • translating SMB protocol SIDs (Security IDentifiers) to POSIX user and group names <host> • hostnames • net groups • ips • ip ranges Username_mapping: // move; ?! • standard cfg file • maps usernames which the client may send to UNIX usernames valid on the server <UNIX_name> = <name>* HTTP:"Hyper Text Transfer Protocol" • network protocol designed for transferring HTML/XML • HTTP is not a secure protocol, all communication can be trivially snooped over the network • HTTPS ("HTTP Secure") is the encrypted equivalent of HTTP and the de facto standard, the two are virtually identical in other aspects Response_codes: https://http.dev/status"status codes" • response codes are organized into logical batches by their hundreds • response codes are not laid out continuously (even within batches)
// Informational 100 : Header successfully received, continue on with sending the body 101 : Upgrade header accepted, switching protocols 102 : Processing; intermediate response to inform the user that the request is successful, but the server is still processing 103 : Early Hints; used with a link header to allow the user to load resources while the server doesnt send a full response // Success 200 : OK 201 : Created 202 : Accepted; however it doesnt mean that the process has completed 203 : Non-Authoritative Information; a 200 request that has been altered by a proxy 204 : No Content; indicates success and that the user doesnt have to navigate away (see BELOW) {saving an online document} 205 : Reset Content; indicates success and that the user should refresh the site (see ABOVE) 206 : Partial Content 207 : Multi-Status 208 : Already Reported; WebDAV thing 226 : Instance Manipulation used // Redirection 300 : Multiple Choices; multiple possible responses, the user shall choose 301 : Moved permanently 302 : Found; temporarily moved 303 : See Other 304 : Not Modified 305 : Use Proxy 306 : Switch Proxy 307 : Temporary Redirect 308 : Permanent Redirect // Client Error 400 : Bad Request; the server will not process the request due to user error 401 : Unauthorized 402 : Payment Required 403 : Forbidden; like 401, but no re-authentication will make a difference, the request is permanently forbidden by the server 404 : Not Found 405 : Method Not Allowed; the request method is recognized, but not supported 406 : Not Acceptable; for example wrong character set 407 : Proxy Authentication Required 408 : Request Timeout; sent by a server that would like to close an idle connection 409 : Conflict; request could not be satisfied 410 : Gone; permanently inaccessible 411 : length Required; the server will not accept the request without a Content-length header 412 : Precondition Failed; user supplied condition is false (and so the request shall not be satisfied) 413 : Payload Too Large 414 : URI Too Long 415 : Unsupported Media Type; payload's format is unacceptable 416 : Range Not Satisfiable 417 : Exception Failed 418 : I'm a Teapot // you inside a specification etherealized 421 : Misdirected Request 422 : Unprocessable Entity; understood, but cannot be satisfied 423 : Locked 424 : Failed Dependency 425 : Too Early; protection from a Replay attack 426 : Upgrade Required; indicates that the user should change protocols 428 : Precondition Required 429 : Too Many Requests 431 : Request Header Fields Too Large 451 : Unavailable For Legal Reasons // Server Error 500 : Internal Server Error 501 : Not Implemented 502 : Bad Gateway; the server failed to successfully communicate with another server 503 : Service Unavailable 504 : Gateway Timeout; the server encountered a timeout while it tried to communicate with another server 505 : HTTP Version Not Supported 506 : Variant Also Negotiates 507 : Insufficient Storage 508 : Loop Detected; server terminated an operation cause it identified an infinite loop 510 : Not Extended; requirements to access the resource were not met, information to satisfy those requirements are sent 511 : Network Authentication Required

www

#define www:: \ I _ ___ ___ __ \ I | | /| / / | /| / / | /| / / \ I | |/ |/ /| |/ |/ /| |/ |/ / \ I |__/|__/ |__/|__/ |__/|__/ I "World Wide Web"/"Web" (for short) • World Wide Web is actually faster to say than "Double U Double U Double U" • the subset of the Internet which depends on the browser/markup stack Technologies_involved: — deprecated: • Java (applets) • Flash // goodnight, sweet prince — current: • HTML • CSS • Javascript • web asm Render_engines: • each web browser depends on one • responsible for parsing markup, applying styling and calculating layout • due to the horror show that is the ever-changing standard, no independent developer could ever create on ○ every engine in use as of 2025 • Gecko (by Mozilla) {Firefox} • Chromium Embedded Framework (by CEF Group) {Chromium; Chrome; Brave} • WebKit (by Apple) {Safari} BOTS: • a web bot is a piece of software that automates some operation on the WWW Scrapper: • data collector • purposefully extracts information from a webpage • stores the scrapped data in a structured format ### Rules for writing scrappers ### — always browse the site first: • check for errors • check for response code standard compliance — try curl: • see how badly its js-poozed • see what tags were auto corrected by your browser • check for protocol errors — consider using browser js: • as in, either type away in the console or create a user script, depending on the situation • many times its the easiest and fastest way to extract data • good idea when doing a one time thing — consider using wget: • many dont know how versatile it is • it could be easier and faster to extract information from a local copy — use local copies for testing: • can safe lots of time • can spare you from bans • can spare you from network errors — check for gray-APIs: • suspect it with fancy interfaces • sniffing the requests might be the easiest path to take # Crawler:"spider" • navigates a site or sites through a series of available links • most commonly scraps keywords in the process used for indexing • most search engines utilize crawlers Sniper: • performs a single action requiring precision • most commonly refers to bot waiting for a condition and reacting as fast as possible { biding at the last possible chance in an auction } ○ common tools for writing bots • Curl • Python/Requests • Python/Beautifulsoup • Selenium • Cypress with plugins #define UI\

user_interface

#define user_interface\ #define UX\ #define user_experience\ #define UX/UI: \ II--------------------------------------------------------------I\ II--------------------------------------------------------------I\ II AW I\ II `7MMF' `7MF'`7MMF' ,M'`7MMF' `7MF'`YMM' `MP' I\ II MM M MM MV MM M VMb. ,P I\ II MM M MM AW MM M `MM.M' I\ II MM M MM ,M' MM M MMb I\ II MM M MM MV MM M ,M'`Mb. I\ II YM. ,M MM AW YM. ,M ,P `MM. I\ II `bmmmmd"' .JMML.,M' `bmmmmd"' .MM:. .:MMa. I\ II MV I\ II AW I\ II--------------------------------------------------------------I\ II--------------------------------------------------------------II https://interactionmagic.com/UX-LEGO-Interfaces/ • people are unironically getting payed for UX, not only that, more often than not, they are fucking terminally retarded • the better looking something is, the better it is perceived, this is called the Aesthetic-Usability Effect this chapter contains generic UX theory and GUI details, for specifically CLI/TUI UX see AT "/Termdev" — aspects of UIs: ooooooooooo oo oo o \ o o \ Widgets o o \_ o o \__________o o Layout | o o | Style o o | o oo | oo oooooooooooo widget type defines the available functionality and generic look of an element { button } • style defines the precise look of elements { blue background } • layout defines how elements are sized, placed next to eachother and change their size { vertical stacking of buttons } • a framework with any taste will have proper separation and or consistent combining of these aspects {TK; QT; NOT HTML/CSS} Sloppy_focus: • when the mouse auto shifts focus to the element under it • most often used in desktop environments when the hovered window is auto focused • introduces numerous problems for non-conventionally windowed programs Window: • well bordered area • its contents are independent from the rest of the screen — traditionally: • is square • has a border • has a title — has 3 controls located on the border • hide • minimize/maximize • close ┏━━━━━━━━━━━━━━━━━┓ ┃ my window - □ x┃ ┣━━━━━━━━━━━━━━━━━┫ │ │ │ Hello World │ │ │ │ │ └─────────────────┘ Cursor: • its main intent is to mark a location • may or may not have other states • for example in imperative SQL wrappers, where search results are iterated, the internal variable to the SQL engine which marks the current result is often called a cursor { // Terminals have (emulated) hardware cursors, which mark where text should be inserted ┌─────────────┐ │ PS1$ █ │ │ │ │ │ │ │ └─────────────┘ } Pointer: ○ commonly controlled by one of these devices • mouse • trackpad • trackpoint • joystick • movable to arbitrary locations on the screen (in practice this usually means pixel-addressability) { // traditional "mouse style" pointer . |\ l } Switch:"flip-flop control" • a user input with a binary state Check_box:"tick box" • a switch that is represented as box indicating the state and usually a label too • often comes in batches • conventially a square (except Apple seems to have started breaking that) { ┌─────────────────────────────┐ │ Which liqueurs do you like? │ ├─────────────────────────────┤ │ ○ Rum │ │ ⊗ Tonic │ │ ⊗ Vodka │ │ ○ Whiskey │ └─────────────────────────────┘ } Push_button: • a switch that auto resets when it looses active input { // your keyboard is filled with such . -------------------------------------------------------------------. | [Esc] [F1][F2][F3][F4][F5][F6][F7][F8][F9][F0][F10][F11][F12] o o o| | | | [`][1][2][3][4][5][6][7][8][9][0][-][=][_<_] [I][H][U] [N][/][*][-]| | [|-][Q][W][E][R][T][Y][U][I][O][P][{][}] | | [D][E][D] [7][8][9]|+|| | [CAP][A][S][D][F][G][H][J][K][L][;]['][#]|_| [4][5][6]|_|| | [^][\][Z][X][C][V][B][N][M][,][.][/] [__^__] [^] [1][2][3]| || | [c] [a][________________________][a] [c] [<][V][>] [ 0 ][.]|_|| `--------------------------------------------------------------------' dp } Switch_button: • a switch, that looks like a button { // Our on/off button always displays a state on it [on] /* OR */ [off] // now, what do you think, does our button display // the current state or the next? // dunno? exactly. its confusing. } • dont do it please; or at least put verbs on it { "turn off" } Dropdown: • a property of widgets which signals that the complete interface is not visible without input • the name originates from how in practice it is usually being implemented as a menu that expands downwards on click, layed over other elements // ?!; write something about auto closing dropdows and how button holding would be a solution Snipper: • directional controls accompanying a state display, which may or may not itself be a {text} input • convenient with input repeat acceleration { ┌──────┬───┐ │ /| │ A │ │ | │ V │ └──────┴───┘ } Slider: • an elongated user input • its two ends represent two values between which the user can select a value • usually linear • its best used where the user gets instant visual feedback on its selection { ┏━━━━━━━━━━━━━━━━━━━━━━━━┓ ┏━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ ┃ ┃ .--' ┃ ┃ ┃ ┃ .--' ┃ ┃ ┃ ┃ .--' ┃ ┃------------------------┃ ┃--' ┃ ┣━━━━━━━━━━━━━━━━━━━━━━━━┫ ┣━━━━━━━━━━━━━━━━━━━━━━━━┫ ┃ Angle: ├█────────────┤ ┃ ┃ Angle: ├──█──────────┤ ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━━━━━━┛ } Scroller: • a slider which is used for moving a viewport over an area • modern scrollers handle shrink in size proportional to the displayable arena's size • scrollers are traditionally fit with snippers • can be used to mark the position of search results • please stop using snippers for scrollers, they are utterly useless; your mouse has a SCROLL wheal, your keyboard has arrow keys, your touchpad supports guestures, your trackpoint has the smoothest scrolling imaginable and most screens in personal usage are touch screens — scroll bars are useful for even for those who do not use them: • they display the users corrent location • they (can) hint at the documents length • they allow for fast and precise navigation • please stop making scroll bars that dont jump on click; {good: firefox; bad: chrome} { ┏━━━━━━━━━━━━━━┳━┓ ┃Our OS who art┃^┃ ┃in CPU, UNIX ┃█┃ ┃be thy name. ┃█┃ ┃Thy programs ┃|┃ ┃run, thy ┃|┃ ┃syscalls done,┃|┃ ┃in kernel as ┃V┃ ┗━━━━━━━━━━━━━━┻━┛ it is in user!│ │Give us this day our daily │ │cycles, And forgive us our│ │GOTO's As we forgive them │ │that also use BASIC. Lead us│ │not into FORTRAN, But │ │deliver us from COBOL. │ │For thine is the for loop, │ │the while and the switch For│ │ever and ever, Amen. │ └ ── ── ── ─┘ } Canvas: • a continuous arena where uniform, atomic sections are writable Miller_collumns: • tree traversing widget • the children of each selected branch is kept in its own collumn • all children of a selected branch is displayed { // File browsing with miller collumns ┌───────┬──────────────┬─────────┐ │ bin/ │>EFI/ │ BOOT/ │ │>boot/ │ grub/ │ EFI/ │ │ dev/ │ config-6.0.2-│#gentoo/ │ │ etc/ │ config-6.5.7-│ GRUB/ │ │ home/ │ config-6.7.2-│ │ │ ... │ ... │ │ └───────┴──────────────┴─────────┘ } • works best when the number of nodes is enough to warrant such complex widget, but not so much that displaying it on the screen becomes a clutter (as it may have to start squashing collumns or have horizontal scolling for elements to fit) • they can be used to visualize data filtering too • they can be used to visualize data filtering too Popup: https://bytepointer.com/resources/old_new_thing/20030901_039_the_default_answer_to_every_dialog_box_is_cancel.htm • appears above the rest of the application • corresponds to a main window or process • may or may not have its own window • a dialog box is a popup with input widgets; when mentioning popups, in most cases we are refering to dialog boxes { // Typical desktop popup (under Linux) ┏━━━━━━━━━━━━━━━━━┓ ┃ my window - □ x┃ ┣━━━━━━━━━━━━━━━━━┫ │ ┏━━━━━━━━━━━━━┓ │ │ ┃ popup - □ x┃ │ │ ┣━━━━━━━━━━━━━┫ │ │ │ Halt & │ │ │ │ catch fire? │ │ │ │ [no] [yes] │ │ │ └─────────────┘ │ └─────────────────┘ // Typical website popup ┌─────────────────┐ │ Search (______) │ │ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ ˇ│ │ #What is a pig? │ │ pigs most often │ │ wear blue and │ │---------------x-│ │ We use cookies │ └─────────────────┘ } — popups are terrible: • they create surprise • they block the user from trying to do what he wants • most users never read popups, instead look for the fastest way to get rid of them • if the user is unsure of what the popup means, she will almost always click no/cancel { Cookie notifications are annoying beyond belief and that's a fact. // --- "How do I make this error message go away?\ It appears every time I start the computer." "What does this error message say?" "It says, 'Updates are ready to install.' I've just been clicking the X\ to make it go away, but it's really annoying." // --- "Every time I start my computer, I get this message that says\ that updates are ready to install. What does it mean?" "It means that Microsoft has found a problem that may allow a computer virus\ to get into your machine, and it's asking for your permission to fix the problem.\ You should click on it so the problem can be fixed." "Oh, that's what it is? I thought it was a virus, so I just kept clicking No." // --- "When I start the computer I get this big dialog that talks about Automatic Updates.\ I've just been hitting Cancel. How do I make it stop popping up?" "Did you read what the dialog said?" "No. I just want it to go away." // --- "Sometimes I get the message saying that my program has crashed and\ would I like to send an error report to Microsoft. Should I do it?" "Yes, we study these error reports so we can see how we can fix\ the problem that caused the crash." "Oh, I've just been hitting Cancel because that's what I always do\ when I see an error message." "Did you read the error message? "Why should I? It's just an error message.\ All it's going to say is 'Operation could not be performed because\ blah blah blah blah blah.'" // --- Chromium has been asking me for authentication for the past 3 years and counting; however, pressing escape 3 times proves to be much more convenient. } • the one typical legit use is "There are unsaved changes, are you sure you want to quit?"; because we seriously do want the user to pay attention, the message will be understandable for everyone and we dont really have any other means to communicate with the user as the application is probably about to be shut down or atleast the workspace is being closed; however, not placing a "Do not ask me again." button on it is a Serbian-tier war crime {damn you Wireshark, let me quit!} Minimap: • a smaller and compressed display of some other navigatable are • most used in gamedev • can be used in any application with a large traversable area { CS 1.6 (map) minimap; } Satelitemap: — special type of minimap which: • displays an outline of the viewport • can be directly interacted with for navigation { VSCode (code outline) minimap; Ghidra (grap view) minimap; } Layout_engines: "Auckland Layout Model" • a library or framework providing a way for the developer to manage layouts • its responsibility is to determine the position and size of widgets Constraints: • a constraint solver can be deployed to calculate ideal sizes; alternatively, its also common practice to throw if statemates to the problem until our layout looks sort of ok, from the right angles and using the right sizes — wigdet layout aspects: • minimum size • preferred size • maximum size // less common • shrink panelty • expand panelty • a hard constraint is a rule that must be sattisfied when rendering { A is atleast 50 pixels wide } • a soft constraint is a rule that should be sattisfied when rendering { A must be twice as wide as B } • soft constraints are commonly transformed into a hard constraint representation with a penalty value Patterns: // ?! Absolute: { ncurses; X11 windows; html absolute } • defined with absolute coordinates • dynamic (size) changes are the explicit responsibility of the programmer Pack: { terminal; tcl/tk pack; html box&inline } • elements follow each other • where one element ends, the next will start • horizontal, vertical and/or directional Grid: • a table Elastic: • a spring is an elastic layout construction that is blank and takes up as much space as possible; it is used to squize other elements { Qt } • an anchor is an elastic layout construct that is blank and takes up as little space as possible while binded to other elements { Android } • placing the same elastic layout constructs on opposite sides of an element creates equilibrium { // Placing an element to the bottom /* Spring */ /* Anchor */ ┌───────────┐ ┌───────────┐ │ A │ │ │ │ | │- pushing │ │ │ | │ │ │ │ V │ │ │ │┌─────────┐│ │┌─────────┐│ ││ ││ ││ ││ ││ ││ ││ ││ │└─────────┘│ │└────X────┘│- pulling └───────────┘ └─────X─────┘ // Placing an element to the vertical center /* Spring */ /* Anchor */ ┌───────────┐ ┌─────X─────┐ │ A │ │ | │ │ | │- pushing │ | │- pulling │ V │ │ | │ │┌─────────┐│ │┌────X────┐│ ││ ││ ││ ││ ││ ││ ││ ││ │└─────────┘│ │└────X────┘│ │ A │ │ | │ │ | │- pushing │ | │- pulling │ V │ │ | │ └───────────┘ └─────X─────┘ } Text_layout: • determining the optimal layout of text is complex; for printable documents its a harsh reality; for screens, we luckily have scroll areas Unnamed_scroll: • when empty space is inserted at the end of a scroll area • if the user has a preferred screen area where he reads, he gains the ability move even the last few elements up there; making it less likely their eyes are going to skip it entirely • i legit do not know what this could be called; most definitely not scroll padding, because CSS uses that to name something different <html> <body> <div id=main-scroller> </div> <script> const target = document.getElementById('main-scroller'); function addEntry(i = 0) { const e = document.createElement('div'); e.innerText = `# Entry ${i}`; e.style.height = '100px'; e.style.border = "2px solid blue"; e.style.margin = "10px"; target.appendChild(e); } function addPadder() { const e = document.createElement('div'); e.style.height = (window.innerHeight - (100 + 10*2 + 2*2)) + "px"; target.appendChild(e) } // --- for (let i = 0; i < 10; i++) { addEntry(i); } addPadder(); </script> </body> </html>