å ¥åãã¿ã³ã¯å ã®äœçœ®ã«æ»ããŸãã
ã«ãŠã³ããéå§ããã«ã¯ããEnterããã¿ã³ãæŒãããç¬éãéžæããŸãã ãã®æç¹ã§ããã®ãã¿ã³ãæ åœããåè·¯ãéããŸãã ããŒããŒãã®è«çåè·¯ã«å°ããªé»æµãæµããŸãã ãã¹ãŠã®ã¹ã€ããã®ç¶æ ãã¹ãã£ã³ããæµ®éé»æ°ãã«ã¹ãæå¶ããããŒã¹ãããŒã¯ãããŒã³ãŒã13ã«å€æããŸããã³ã³ãããŒã©ãŒã¯ã³ãŒãããšã³ã³ãŒãããŠã³ã³ãã¥ãŒã¿ãŒã«éä¿¡ããŸãã çŸåšãããã¯ã»ãšãã©åžžã«USBãŸãã¯Bluetoothçµç±ã§ãPS / 2ãŸãã¯ADBãããã»ã¹ã«åå ããåã«è¡ãããŸãã
USBã®å Žå
ããŒããŒãã®USBã«ã¯ãã³ã³ãã¥ãŒã¿ãŒã®USBãã¹ãã³ã³ãããŒã©ãŒã®æåã®ãã³ã§5Vã®é»å§ãäŸçµŠãããŸãã ããŒã³ãŒãã¯ãããŒããŒãã¡ã¢ãªã®ããšã³ããã€ã³ããã¬ãžã¹ã¿ã«ä¿åãããŸãã 10ããªç§ããšã«ãUSBã³ã³ãããŒã©ã¯ãã®ã¬ãžã¹ã¿ããããŒã¿ãèŠæ±ããŸãã ããã§åœŒã¯ä¿åãããã³ãŒããååŸããŸãã ã³ãŒãã¯USB SIEïŒã·ãªã¢ã«ã€ã³ã¿ãŒãã§ã€ã¹ãšã³ãžã³ïŒã«è»¢éãããäœã¬ãã«USBãããã³ã«ã®1ã€ä»¥äžã®ãã±ããã«å€æãããŸãã HIDïŒHuman Interface DeviceïŒã¯äœéããã€ã¹ãšèŠãªãããããããã±ããã¯å·®åé»æ°ä¿¡å·ãä»ããŠD +ããã³D-ãã³ãä»ããŠæ倧é床1.5 Mb / sã§éä¿¡ãããŸãã
ã·ãªã¢ã«ä¿¡å·ã¯ã³ã³ãããŒã©ãŒã§ãã³ãŒããããããŒããŒãHIDãã©ã€ããŒã«ãã£ãŠè§£éãããŸãã ã³ãŒãã®å€ã¯ããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®ã¢ã€ãã³ã®æœè±¡åã¬ã€ã€ãŒã«æž¡ãããŸãã
ä»®æ³ããŒããŒãïŒã¿ããã¹ã¯ãªãŒã³ïŒã®å Žå
ãŠãŒã¶ãŒã容éæ§ã¹ã¯ãªãŒã³ã«æã眮ããšããŠãŒã¶ãŒãšæã®éã«å°ããªé»æµãæµããŸãã ããã«ãããå°é»å±€ã®éé»çå ã®åè·¯ãéããããç»é¢ã®ãã®ãã€ã³ãã§é»å§éäžãçºçããŸãã ã¹ã¯ãªãŒã³ã³ã³ãããŒã©ãŒã¯å²ã蟌ã¿ãçºçãããæŒãã座æšãå ±åããŸãã
ã¢ãã€ã«OSã¯ãGUIèŠçŽ ïŒãã®å Žåã¯ä»®æ³ããŒããŒãã®ããŒïŒã®1ã€ãã¯ãªãã¯ãããšãçŸåšã®ã¢ããªã±ãŒã·ã§ã³ã«ã¡ãã»ãŒãžãéä¿¡ããŸãã ããŒããŒãã¯å²ã蟌ã¿ãçºçãããŠãOSã§ã®ããŒã®æŒäžã«é¢ããã¡ãã»ãŒãžãéä¿¡ããŸãã
äžæïŒUSBããŒããŒãã§ã¯ãªãïŒ
ããŒããŒãã¯ãå²ã蟌ã¿èŠæ±ïŒIRQïŒãéä¿¡ããŸããããã¯ãå²ã蟌ã¿ã³ã³ãããŒã©ãŒãå²ã蟌ã¿ãã¯ãã«ã«ããããããã®ã§ãã CPUã¯ãIDTå²ã蟌ã¿èšè¿°åããŒãã«ã䜿çšããŠãã«ãŒãã«ãæäŸããå²ã蟌ã¿ãã³ãã©ãŒé¢æ°ã«ãã¯ãã«ããããããŸãã å²ã蟌ã¿ãå°çãããšãCPUã¯ç®çã®ãã³ãã©ãŒãéå§ããŸãã ã ããç§ãã¡ã¯æ žå¿ã«å°éããŸãã
ïŒWindowsïŒWM_KEYDOWNã¡ãã»ãŒãžãã¢ããªã±ãŒã·ã§ã³ã«éä¿¡ãããŸã
HIDã¯ã¯ãªãã¯ã€ãã³ããKBDHID.sysãã©ã€ããŒã«æž¡ãããããã¹ãã£ã³ã€ãã³ãã«å€æããŸãã ãã®äŸã§ã¯ãVK_RETURNïŒ0x0DïŒãšçãããªããŸãã ãã®ãã©ã€ããŒã¯ãKBDCLASS.sysãã©ã€ããŒãšéä¿¡ããŸãã åŸè ã¯ãããŒããŒãå ¥åãå®å šãªæ¹æ³ã§åŠçãã責任ããããŸãã Win32K.sysãåŒã³åºããŸãïŒç°ãªãããŒããŒããã£ã«ã¿ãŒãä»ããŠã¡ãã»ãŒãžãéä¿¡ããåŸïŒã ããã¯ã«ãŒãã«ã¢ãŒãã§çºçããŸãã
Win32K.sysã¯ãGetForegroundWindowïŒïŒAPIãä»ããŠã¢ã¯ãã£ããªãŠã£ã³ããŠãèªèããŸãã ãã®APIã¯ããã©ãŠã¶ã®å ¥åè¡ã®ãã³ãã«ãæäŸããŸãã 次ã«ãWindowsã¡ãã»ãŒãžã³ã°ã·ã¹ãã ã¯SendMessageïŒhWndãWM_KEYDOWNãVK_RETURNãlParamïŒãåŒã³åºããŸãã lParam-æŒãããšã«é¢ããè¿œå æ å ±ãå«ãããããã¹ã¯-ç¹°ãè¿ããã¹ãã£ã³ã³ãŒããè¿œå ã®ããŒãæŒããããã©ãããªã©
SendMessage APIã¯ãæå®ããããŠã£ã³ããŠãã³ãã«ïŒhWndïŒã®ã¡ãã»ãŒãžããã¥ãŒã«å ¥ããŸãã ãã®åŸãWindowProcã®ã¡ãã»ãŒãžåŠçé¢æ°ããã¥ãŒãåŠçããããã«åŒã³åºãããŸãã
ã¢ã¯ãã£ããªhWndãŠã£ã³ããŠã¯ç·šéãŠã£ã³ããŠã§ãããã®å ŽåãWindowProcã«ã¯WM_KEYDOWNã®ã¡ãã»ãŒãžãã³ãã©ããããŸãã ã³ãŒãVK_RETURNãæž¡ãããããããŠãŒã¶ãŒãEnterããŒãæŒããããšãç¥ã£ãŠããŸãã
ïŒOS XïŒã¢ããªã±ãŒã·ã§ã³ã«æž¡ãããKeyDown NSEvent
å²ã蟌ã¿ä¿¡å·ã¯ãI / O Kitãã©ã€ããŒã§ã€ãã³ããããªã¬ãŒããŸãã ä¿¡å·ãããŒã³ãŒãã«å€æããWindowServerããã»ã¹ã«æž¡ããŸãã 圌ã¯ãMachããŒããä»ããŠã¢ã¯ãã£ããªã¢ããªã±ãŒã·ã§ã³ã®ã€ãã³ããäœæããŸãã ãããã®ã¢ããªã±ãŒã·ã§ã³ã®ã€ãã³ãã¯ãã¥ãŒã«å ¥ããããŸãã ãããã¯ãmach_ipc_dispatché¢æ°ã䜿çšããŠé©åãªã¢ã¯ã»ã¹ã¬ãã«ãæã€ã¹ã¬ããã«ãã£ãŠããããèªã¿åãããŸãã ããã¯ã»ãšãã©ã®å ŽåãNSEvent / NSEventType KeyDownã䜿çšããŠã¡ã€ã³NSApplicationã«ãŒãã§å®è¡ãããŸãã
ïŒGNU / LinuxïŒXorgãµãŒããŒã¯ã³ãŒãã远跡ããŸã
Xã°ã©ãã£ãã¯ãµãŒããŒã䜿çšããå Žåãevdevãã©ã€ããŒã䜿çšããŠã³ãŒããååŸããŸãã æ¢åã®èŠåã«åŸã£ãŠãããŒã³ãŒãã¯ã¹ãã£ã³ã³ãŒãã«å€æãããŸãã ãã®åŸãã·ã³ãã«ã¯ãŠã£ã³ããŠãããŒãžã£ïŒDWMãmetacityãi3ãªã©ïŒã«è»¢éããããŠã£ã³ããŠãããŒãžã£ã¯ã·ã³ãã«ããã©ãŒã«ã¹ãããŠãããŠã£ã³ããŠã«æž¡ããŸãã ã°ã©ãã£ã«ã«ãŠã£ã³ããŠAPIã¯ã·ã³ãã«ãåãåãããã©ãŒã«ã¹ã眮ãããŠãããŠã£ã³ããŠã«å¯Ÿå¿ããã·ã³ãã«ã衚瀺ããŸãã
URL解æ
ãã©ãŠã¶ã«ã¯ãURLïŒUniform Resource LocatorïŒããã®æ¬¡ã®æ å ±ãå«ãŸããŠããŸãã
HTTPãããã³ã«-ããã€ããŒããã¹ã転éãããã³ã«ãã䜿çšããŸã
ãªãœãŒã¹ã/ã-ã¡ã€ã³ããŒãžããªã¯ãšã¹ã
ããã¯URLã§ããããããšãæ€çŽ¢ã¯ãšãªã§ããïŒ
ãããã³ã«ãæå®ãããŠããããæååãæå¹ãªãã¡ã€ã³åã§ã¯ãªãå Žåããã©ãŠã¶ã¯ãã®ããã¹ããããã©ã«ãã®æ€çŽ¢ãšã³ãžã³ã«æž¡ããŸãã
HSTSãªã¹ãã確èª
ãã©ãŠã¶ã¯ãHSTSïŒHTTP Strict Transport SecurityïŒãªã¹ãããã§ãã¯ããŸãã ããã¯ãHTTPSçµç±ã§ã®ã¿ã¢ã¯ã»ã¹ããå¿ èŠããããµã€ãã®ãªã¹ãã§ãã ãµã€ãããªã¹ããããŠããå Žåããã©ãŠã¶ã¯HTTPSçµç±ã§ãªã¯ãšã¹ããéä¿¡ããŸãã ãã以å€ã®å ŽåãHTTPçµç±ã
ASCIIããŒãã«ã«é¢é£ããªããµãŒããŒåã®æåãå€æããŸãã
ãã©ãŠã¶ã¯ãç¯å²aãzãAãZã0ã9ã-ããæåããããã©ããã確èªããŸãã
google.comãããã®ã§ããã®ãããªãã£ã©ã¯ã¿ãŒã¯ãããŸããã ãã以å€ã®å ŽåãPunycodeã·ã¹ãã ã䜿çšãããšã³ã³ãŒãããµãŒããŒåã«é©çšãããŸãã
DNSã¯ãšãª
ãã©ãŠã¶ã¯ããã¡ã€ã³ããã£ãã·ã¥ã«ãããã©ããã確èªããŸãã ããã§ãªãå Žåãgethostbynameã©ã€ãã©ãªãŒé¢æ°ãåŒã³åºãããŸãïŒOSã«äŸåïŒã ããŒã«ã«ãã¹ããã¡ã€ã«ã®æ å ±ã«åºã¥ããŠããµãŒããŒã¢ãã¬ã¹ãååã§èŠã€ãããã©ããã確èªããŸãã ããã§è§£æ±ºããªãå Žåã¯ããããã¯ãŒã¯èšå®ã§æå®ãããŠããDNSãµãŒããŒã«å¯ŸããŠèŠæ±ãè¡ãããŸãã ããã¯ãããŒã«ã«ã«ãŒã¿ãŒãŸãã¯ãããã€ããŒã®DNSãµãŒããŒã§ãã DNSãµãŒããŒãåããµããããäžã«ããå Žåãã©ã€ãã©ãªã¯ãµãŒããŒã§ARPãå®è¡ããŸãã ãã以å€ã®å ŽåãèŠæ±ã¯æšæºã²ãŒããŠã§ã€ã®IPã¢ãã¬ã¹ã«éä¿¡ãããŸãã
ARPïŒã¢ãã¬ã¹è§£æ±ºãããã³ã«ïŒ
ARPãããŒããã£ã¹ãèŠæ±ãéä¿¡ããã«ã¯ããããã¯ãŒã¯ã¹ã¿ãã¯ãåä¿¡è ã®IPã¢ãã¬ã¹ãšãããã«äœ¿çšãããã€ã³ã¿ãŒãã§ã€ã¹ã®MACã¢ãã¬ã¹ãç¥ã£ãŠããå¿ èŠããããŸãã
ãŸããARPãã£ãã·ã¥ã§åä¿¡è ã®IPã確èªãããŸãã ãã£ãã·ã¥ã«ããå Žåãçµæã¯ãrecipient IP = MACãã§è¿ãããŸãã
ãã£ãã·ã¥ã«ãªãå Žåãã«ãŒãã£ã³ã°ããŒãã«ãã¹ãã£ã³ãããããŒã«ã«ãµããããã®ããããã«IPã¢ãã¬ã¹ãååšãããã©ããã確èªãããŸãã ååšããå Žåããã®ãµããããã«å²ãåœãŠãããã€ã³ã¿ãŒãã§ãŒã¹ã䜿çšãããŸãã ããã§ãªãå Žåãã©ã€ãã©ãªã¯ãã©ã€ããªã²ãŒããŠã§ã€ã®ãµããããã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããŸãã 次ã«ãéžæããã€ã³ã¿ãŒãã§ã€ã¹ã®MACã¢ãã¬ã¹ãæ€çŽ¢ãããã¬ã€ã€ãŒ2 ARPèŠæ±ãéä¿¡ãããŸãã
Sender MAC: interface:mac:address:here Sender IP: interface.ip.goes.here Target MAC: FF:FF:FF:FF:FF:FF (Broadcast) Target IP: target.ip.goes.here
ã³ã³ãã¥ãŒã¿ãŒãã«ãŒã¿ãŒã«çŽæ¥æ¥ç¶ãããŠããå Žåãã«ãŒã¿ãŒã¯ARPå¿çãè¿ããŸãã æ¥ç¶ããããçµç±ããå Žåããã¹ãŠã®ããŒãã«èŠæ±ãéä¿¡ããŸãã ããã«ã«ãŒã¿ãŒãããã°ã圌ã¯çããŸãã æ¥ç¶ãã¹ã€ãããçµç±ããŠããå ŽåãCAM / MACããŒãã«ãããã©ã®ããŒãã«ç®çã®MACã¢ãã¬ã¹ãããããå€å¥ãããŸãã ããã§ãªãå Žåããã¹ãŠã®ããŒãã«ãªã¯ãšã¹ããé ä¿¡ããŸãã ãããŠããããããªããããã¯èŠæ±ãããMACãããããŒãã«ãªã¯ãšã¹ããéä¿¡ããŸãã
è¿ä¿¡ARPè¿ä¿¡ïŒ
Sender MAC: target:mac:address:here Sender IP: target.ip.goes.here Target MAC: interface:mac:address:here Target IP: interface.ip.goes.here
ããã§ãã©ã€ãã©ãªã«ã¯DNSãµãŒããŒãŸãã¯ã¡ã€ã³ã²ãŒããŠã§ã€ã®IPã¢ãã¬ã¹ãèšå®ãããŸããã ãã¡ã€ã³èªèã®ããã»ã¹ãç¶è¡ã§ããŸãã ããŒã53ãéããUDPèŠæ±ããµãŒããŒã«éä¿¡ãããŸãïŒèŠæ±ã倧ããå ŽåãTCPã䜿çšãããŸãïŒã DNSãµãŒããŒããæ å ±ããªãå Žåã¯ãååž°æ€çŽ¢ãèŠæ±ãããSOAã«å°éããŠç®çã®åçãèŠã€ãããŸã§DNSãµãŒããŒã®ãªã¹ãã調ã¹ãŸãã
ãªãŒããã³ã°ãœã±ãã
ãã©ãŠã¶ãŒã¯å®å ãµãŒããŒã®IPã¢ãã¬ã¹ãåä¿¡ãããšãããŒãïŒããã©ã«ãã®HTTPããŒãã¯HTTPS 443ã®å Žåã¯80ïŒã䜿çšããŠããœã±ããé¢æ°ãåŒã³åºããã©ã¡ãŒã¿ãŒãšããŠäœ¿çšããTCPãœã±ããã¹ããªãŒã ïŒAF_INETããã³SOCK_STREAMïŒãèŠæ±ããŸãã
æåã«ããã®èŠæ±ã¯ãã©ã³ã¹ããŒãå±€ã«æž¡ãããããã§TCPã»ã°ã¡ã³ããäœæãããŸãã å®å ããŒããããããŒã«è¿œå ããããœãŒã¹ããŒããã«ãŒãã«ããŒãã®ãªã¹ãããåçã«éžæãããŸãïŒLinuxã§ã¯ãããã¯ip_local_port_rangeã§ãïŒã
ã»ã°ã¡ã³ãã¯ãããã¯ãŒã¯å±€ã«éä¿¡ãããããã§å®å ãµãŒããŒã®IPã¢ãã¬ã¹ãšã³ã³ãã¥ãŒã¿ãŒã®IPã¢ãã¬ã¹ãå«ãIPããããŒãè¿œå ãããŸãã 次ã«ããã±ããã¯ãªã³ã¯å±€ã«å ¥ããŸãã ãã¬ãŒã ããããŒãè¿œå ãããŸãããã¬ãŒã ããããŒã«ã¯ãã³ã³ãã¥ãŒã¿ãŒãšã²ãŒããŠã§ã€ïŒããŒã«ã«ã«ãŒã¿ãŒïŒã®MACã¢ãã¬ã¹ãå«ãŸããŠããŸãã ã²ãŒããŠã§ã€ã®MACã¢ãã¬ã¹ãã«ãŒãã«ã«ç¥ãããŠããªãå Žåãã²ãŒããŠã§ã€ãèŠã€ããããã«ARPãããŒããã£ã¹ããéä¿¡ãããŸãã ããã§ãããã±ãŒãžãã€ãŒãµããããWiFiããŸãã¯ã¢ãã€ã«çµç±ã§éä¿¡ããæºåãæŽããŸããã
ã»ãšãã©ã®å Žåãã³ã³ãã¥ãŒã¿ãŒããã®ãã±ããã¯ããŒã«ã«ãšãªã¢ãããã¯ãŒã¯ãééããã¢ãã ïŒå€èª¿åš/埩調åšïŒã«éãããããã§ããžã¿ã«ä¿¡å·ããã¢ããã°ä¿¡å·ã«å€æãããŸãã ãã®ãããªä¿¡å·ã¯ãé»è©±ãã±ãŒãã«ããŸãã¯ã¯ã€ã€ã¬ã¹æ¥ç¶ã§éä¿¡ã§ããŸãã åä¿¡åŽã®ã¢ãã ã¯ãããããžã¿ã«åœ¢åŒã«å€æãããããã次ã®ãããã¯ãŒã¯ããŒãã«å°éããããã§éä¿¡è ãšåä¿¡è ã®ã¢ãã¬ã¹ãããã«åæãããŸãã
ãã±ãããã€ãŒãµããããŸãã¯å åŠç³»ãä»ããŠããã«éä¿¡ãããåŸãããžã¿ã«ã®ãŸãŸã§æ¬¡ã®ãããã¯ãŒã¯ããŒãã«å°éããå ŽåããããŸãã æçµçã«ãä¿¡å·ã¯ããŒã«ã«ãµããããã«ãŒã¿ãŒã«å°éããŸãã ãããããå¢çã«ãŒã¿ãŒASãä»ã®ASãééããå®å ãµãŒããŒã«å°éããŸãã éäžã®åã«ãŒã¿ãŒã¯ãå®å IPã¢ãã¬ã¹ãååŸãããã±ããããã¯ã¹ããããã«æž¡ããŸãã ãã®å Žåããã±ããã®TTLã¯1ã€æžå°ããŸãã ãã±ããã¯ããŒãã«å°éããå ŽåããŸãã¯çŸåšã®ã«ãŒã¿ãŒã®ãã¥ãŒã¹ããŒã¹ããªããªã£ãå Žåã«ç Žæ£ãããŸãã ãã±ããã®éåä¿¡ã¯ãTCPæ¥ç¶ã®äžéšãšããŠè€æ°åçºçããŸãã
æåã«ãã¯ã©ã€ã¢ã³ãã¯åæã·ãŒã±ã³ã¹çªå·ïŒISNïŒãéžæããŠãµãŒããŒã«ãã±ãããéä¿¡ããSYNããããèšå®ããŠISNã§ããããšãæ確ã«ããŸãã
ãµãŒããŒãSYNãåä¿¡ããŠââæ°åãè¯ãå ŽåãISNãéžæãããã±ããã«ISNãå«ãŸããŠããããšã瀺ãããã«SYNãèšå®ããACKãã£ãŒã«ãã«ã¯ã©ã€ã¢ã³ãISN + 1ãã³ããŒããACKãã©ã°ãè¿œå ããŠæåã®ãã±ããã®åä¿¡ã確èªããŸãã
ã¯ã©ã€ã¢ã³ãã¯ãISNãå¢å ããéä¿¡è ã®ISNãå¢å ããACKãã£ãŒã«ããèšå®ãããŠãããã±ãããéä¿¡ããããšã«ãããæ¥ç¶ã確èªããŸãã
ããŒã¿ã¯æ¬¡ã®ããã«éä¿¡ãããŸããäžæ¹ãNãã€ããéä¿¡ãããšããã®æ°ã ãSEQãå¢å ããŸãã çžæåŽããã±ããïŒãŸãã¯ãã§ãŒã³ïŒã®åä¿¡ã確èªãããšãACKãã±ãããéä¿¡ããŸããACKå€ã¯ãçžæåŽããåä¿¡ããæåŸã®ã·ãŒã±ã³ã¹ãšçãããªããŸãã
æ¥ç¶ãéããããã«ãéããåŽãFINãã±ãããéä¿¡ããããäžæ¹ããã±ããã®åä¿¡ã確èªããŠFINãéä¿¡ããæåã«åä¿¡ã確èªããŸãã