Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
8
Task/HTTPS/Ada/https.adb
Normal file
8
Task/HTTPS/Ada/https.adb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
with AWS.Client;
|
||||
with AWS.Response;
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
procedure GetHttps is
|
||||
begin
|
||||
Put_Line (AWS.Response.Message_Body (AWS.Client.Get (
|
||||
URL => "https://sourceforge.net/")));
|
||||
end GetHttps;
|
||||
29
Task/HTTPS/M2000-Interpreter/https.m2000
Normal file
29
Task/HTTPS/M2000-Interpreter/https.m2000
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
Module CheckIt {
|
||||
Declare xml "Microsoft.XMLHTTP"
|
||||
const testUrl$ = "https://georgekarras.blogspot.com/"
|
||||
With xml, "readyState" as ReadyState
|
||||
Method xml "Open", "Get", testUrl$, True ' True means Async
|
||||
Method xml "send"
|
||||
\\ We set a thread to count time
|
||||
k=0
|
||||
Thread {
|
||||
k++
|
||||
} as TimeOut interval 100
|
||||
\\ In main thread we can check ReadyState and Mouse button
|
||||
Task.Main 100 {
|
||||
Print ReadyState
|
||||
If ReadyState=4 then exit
|
||||
if k>20 then exit ' 20*100= 2 sec
|
||||
if mouse then exit ' exit if mouse click
|
||||
}
|
||||
\\ So now we can read
|
||||
if ReadyState=4 then {
|
||||
With xml, "responseText" AS AA$
|
||||
\\ break AA$ to lines
|
||||
Document BB$=AA$
|
||||
\\ using line breaks as CRLF
|
||||
Report BB$
|
||||
}
|
||||
Declare xml Nothing
|
||||
}
|
||||
CheckIt
|
||||
1
Task/HTTPS/PowerShell/https-1.ps1
Normal file
1
Task/HTTPS/PowerShell/https-1.ps1
Normal file
|
|
@ -0,0 +1 @@
|
|||
Invoke-WebRequest 'https://www.rosettacode.org'
|
||||
2
Task/HTTPS/PowerShell/https-2.ps1
Normal file
2
Task/HTTPS/PowerShell/https-2.ps1
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
$wc = New-Object Net.WebClient
|
||||
$wc.DownloadString('https://sourceforge.net')
|
||||
1
Task/HTTPS/Rebol/https.rebol
Normal file
1
Task/HTTPS/Rebol/https.rebol
Normal file
|
|
@ -0,0 +1 @@
|
|||
print read https://www.w3.org
|
||||
17
Task/HTTPS/VBScript/https.vbs
Normal file
17
Task/HTTPS/VBScript/https.vbs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
Option Explicit
|
||||
|
||||
Const sURL="https://sourceforge.net/"
|
||||
|
||||
Dim oHTTP
|
||||
Set oHTTP = CreateObject("Microsoft.XmlHTTP")
|
||||
|
||||
On Error Resume Next
|
||||
oHTTP.Open "GET", sURL, False
|
||||
oHTTP.Send ""
|
||||
If Err.Number = 0 Then
|
||||
WScript.Echo oHTTP.responseText
|
||||
Else
|
||||
Wscript.Echo "error " & Err.Number & ": " & Err.Description
|
||||
End If
|
||||
|
||||
Set oHTTP = Nothing
|
||||
88
Task/HTTPS/X86-64-Assembly/https-1.x86-64
Normal file
88
Task/HTTPS/X86-64-Assembly/https-1.x86-64
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
;; The name of this wont get confusing :]
|
||||
|
||||
%macro prolog 1
|
||||
push rbp
|
||||
mov rbp, rsp
|
||||
sub rsp, %1
|
||||
%endmacro
|
||||
|
||||
%macro epilog 1
|
||||
add rsp, %1
|
||||
pop rbp
|
||||
%endmacro
|
||||
|
||||
;;default rel does some crazy shit
|
||||
;;so here we are because of it. T_T
|
||||
%macro xcall 1
|
||||
call [rel %1 wrt ..got]
|
||||
%endmacro
|
||||
|
||||
%macro xlea 2
|
||||
lea %1, [rel %2]
|
||||
%endmacro
|
||||
|
||||
|
||||
extern curl_easy_init
|
||||
extern curl_easy_setopt
|
||||
extern curl_easy_perform
|
||||
extern curl_easy_cleanup
|
||||
extern printf
|
||||
|
||||
%define CURLOPT_URL 0x2712
|
||||
%define CURLOPT_FOLLOWLOCATION 0x34
|
||||
%define CURLOPT_ERRORBUFFER 0x271A
|
||||
%define CURLE_OK 0
|
||||
|
||||
section .rodata
|
||||
szformat db "%s",10,0
|
||||
sznoargs db "usage:",10," curl <url>",10,0
|
||||
|
||||
section .bss
|
||||
buff resb 1024
|
||||
|
||||
section .text
|
||||
global main
|
||||
|
||||
main:
|
||||
prolog 4*8
|
||||
%define url [rbp-1*8]
|
||||
%define curl [rbp-2*8]
|
||||
|
||||
cmp edi, 1
|
||||
jle __main_noargs
|
||||
mov rax, qword [rsi+1*8]
|
||||
mov qword url, rax
|
||||
xcall curl_easy_init
|
||||
mov qword curl, rax
|
||||
cmp rax, 0
|
||||
je __main_exit
|
||||
mov rdi, qword curl
|
||||
mov rdx, qword url
|
||||
mov esi, CURLOPT_URL
|
||||
xcall curl_easy_setopt
|
||||
mov rdi, qword curl
|
||||
mov esi, CURLOPT_FOLLOWLOCATION
|
||||
mov edx, 1
|
||||
xcall curl_easy_setopt
|
||||
mov rdi, qword curl
|
||||
xlea rdx, buff
|
||||
mov esi, CURLOPT_ERRORBUFFER
|
||||
xcall curl_easy_setopt
|
||||
mov rdi, qword curl
|
||||
xcall curl_easy_perform
|
||||
cmp eax, 0
|
||||
je __main_exit
|
||||
xlea rdi, szformat
|
||||
xlea rsi, buff
|
||||
xcall printf
|
||||
jmp __main_exit
|
||||
|
||||
__main_noargs:
|
||||
xlea rdi, sznoargs
|
||||
xcall printf
|
||||
|
||||
__main_exit:
|
||||
mov rdi, qword curl
|
||||
xcall curl_easy_cleanup
|
||||
epilog 4*8
|
||||
ret
|
||||
201
Task/HTTPS/X86-64-Assembly/https-2.x86-64
Normal file
201
Task/HTTPS/X86-64-Assembly/https-2.x86-64
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
%macro prolog 1
|
||||
push rbp
|
||||
mov rbp, rsp
|
||||
sub rsp, %1
|
||||
%endmacro
|
||||
|
||||
%macro epilog 1
|
||||
add rsp, %1
|
||||
pop rbp
|
||||
%endmacro
|
||||
|
||||
%macro xcall 1
|
||||
call [rel %1 wrt ..got]
|
||||
%endmacro
|
||||
|
||||
%macro xlea 2
|
||||
lea %1, [rel %2]
|
||||
%endmacro
|
||||
|
||||
extern printf
|
||||
extern strlen
|
||||
extern strdup
|
||||
extern strchr
|
||||
extern free
|
||||
extern exit
|
||||
|
||||
;; --> OpenSSL Stuffs <--
|
||||
extern BIO_new_ssl_connect
|
||||
extern BIO_ctrl
|
||||
extern BIO_write
|
||||
extern BIO_read
|
||||
extern BIO_free_all
|
||||
extern TLS_client_method
|
||||
extern SSL_CTX_new
|
||||
extern SSL_CTX_free
|
||||
extern SSL_CTX_set_verify
|
||||
extern SSL_CTX_set_default_verify_paths
|
||||
extern SSL_ctrl
|
||||
|
||||
%define BIO_C_SET_CONNECT 100
|
||||
%define BIO_C_DO_STATE 101
|
||||
%define BIO_C_GET_SSL 110
|
||||
%define SSL_CTRL_SET_TLSHOST 55
|
||||
%define SSL_VERIFY_PEER 1
|
||||
|
||||
section .text
|
||||
global xrequest
|
||||
xrequest:
|
||||
prolog 6*8
|
||||
%define _req_host rbp-1*8
|
||||
%define _req_pack rbp-2*8
|
||||
%define _req_buff rbp-3*8
|
||||
%define _req_ssl rbp-4*8
|
||||
%define _req_ctx rbp-5*8
|
||||
%define _req_bio rbp-6*8
|
||||
|
||||
mov rax, rdi
|
||||
mov qword [_req_host], rax
|
||||
mov rax, rsi
|
||||
mov qword [_req_pack], rax
|
||||
mov rax, rdx
|
||||
mov qword [_req_buff], rax
|
||||
xcall TLS_client_method
|
||||
mov rdi, rax
|
||||
xcall SSL_CTX_new
|
||||
test rax, rax
|
||||
jz __req_err_ctx
|
||||
mov qword [_req_ctx], rax
|
||||
mov rdi, qword [_req_ctx]
|
||||
xcall SSL_CTX_set_default_verify_paths
|
||||
test eax, eax
|
||||
jz __req_err_verify
|
||||
mov rdx, 0
|
||||
mov rsi, SSL_VERIFY_PEER
|
||||
mov rdi, qword [_req_ctx]
|
||||
xcall SSL_CTX_set_verify
|
||||
;;-->> Create Bio chain
|
||||
mov rdi, qword [_req_ctx]
|
||||
xcall BIO_new_ssl_connect
|
||||
test rax, rax
|
||||
jz __req_err_bio
|
||||
mov qword [_req_bio], rax
|
||||
;;-->> Get SSL object
|
||||
lea rcx, [_req_ssl]
|
||||
mov rdx, 0
|
||||
mov rsi, BIO_C_GET_SSL
|
||||
mov rdi, qword [_req_bio]
|
||||
xcall BIO_ctrl
|
||||
|
||||
;; -->> Set the SNI hostname.
|
||||
mov rdi, qword [_req_host]
|
||||
xcall strdup
|
||||
mov rdx, rax ; rdx now holds the copy
|
||||
push rdx ; Push pointer to stack
|
||||
mov rdi, rdx
|
||||
mov rsi, ':'
|
||||
xcall strchr
|
||||
test rax, rax
|
||||
jz __req_sni_set
|
||||
mov byte [rax], 0 ; Null-terminate at colon
|
||||
__req_sni_set:
|
||||
mov rdi, qword [_req_ssl]
|
||||
mov rsi, SSL_CTRL_SET_TLSHOST
|
||||
mov rdx, 0
|
||||
mov rcx, [rsp]
|
||||
xcall SSL_ctrl
|
||||
pop rdi
|
||||
xcall free
|
||||
;; -->>Set Hostname (BIO expects "host:port")
|
||||
mov rdi, qword [_req_bio]
|
||||
mov rsi, BIO_C_SET_CONNECT
|
||||
mov rdx, 0
|
||||
mov rcx, qword [_req_host]
|
||||
xcall BIO_ctrl
|
||||
mov rdi, qword [_req_bio]
|
||||
mov rsi, BIO_C_DO_STATE
|
||||
mov rdx, 0
|
||||
mov rcx, 0
|
||||
xcall BIO_ctrl
|
||||
cmp rax, 1
|
||||
jl __req_err_conn
|
||||
|
||||
;; -->> Send Request
|
||||
mov rdi, qword [_req_pack]
|
||||
xcall strlen
|
||||
mov rdx, rax
|
||||
mov rdi, qword [_req_bio]
|
||||
mov rsi, qword [_req_pack]
|
||||
xcall BIO_write
|
||||
|
||||
; -->> Read Response Loop
|
||||
__req_read_loop:
|
||||
mov rdi, qword [_req_bio]
|
||||
mov rsi, qword [_req_buff]
|
||||
mov rdx, 1024
|
||||
xcall BIO_read
|
||||
test eax, eax
|
||||
jle __req_exit
|
||||
add qword [_req_buff], rax
|
||||
jmp __req_read_loop
|
||||
|
||||
|
||||
__req_err_bio:
|
||||
mov r13, -1
|
||||
jmp __req_exit
|
||||
__req_err_verify:
|
||||
mov r13, -2
|
||||
jmp __req_exit
|
||||
__req_err_ctx:
|
||||
;;-->> CTX Error
|
||||
mov r13, -3
|
||||
jmp __req_exit
|
||||
__req_err_conn:
|
||||
mov r13, -4
|
||||
;; fall through..
|
||||
__req_exit:
|
||||
mov r13, rax
|
||||
mov rdi, qword [_req_bio]
|
||||
xcall BIO_free_all
|
||||
mov rdi, qword [_req_ctx]
|
||||
xcall SSL_CTX_free
|
||||
mov rax, r13
|
||||
epilog 6*8
|
||||
ret
|
||||
|
||||
global main
|
||||
main:
|
||||
prolog 4*8
|
||||
|
||||
; request(hostname, request_str, buffer)
|
||||
xlea rdi, hostname
|
||||
xlea rsi, request_str
|
||||
xlea rdx, buffer
|
||||
call xrequest
|
||||
mov rsi, rax
|
||||
xlea rdi, fmt_ret
|
||||
xcall printf
|
||||
|
||||
; Print the response buffer
|
||||
xlea rdi, fmt_str
|
||||
xlea rsi, buffer
|
||||
xor rax, rax
|
||||
xcall printf
|
||||
xor rdi, rdi
|
||||
xcall exit
|
||||
prolog 4*8 ;;Never gets here but w/e.
|
||||
ret
|
||||
|
||||
section .data
|
||||
hostname db "google.com:443", 0
|
||||
request_str db "GET / HTTP/1.1", 13, 10
|
||||
db "Host: google.com", 13, 10
|
||||
db "Connection: close", 13, 10
|
||||
db "User-Agent: TLS-TEST/0.5", 13, 10
|
||||
db 13, 10, 0
|
||||
|
||||
fmt_str db "%s", 0
|
||||
fmt_ret db "%i",10,0
|
||||
|
||||
section .bss
|
||||
buffer resb 16384
|
||||
Loading…
Add table
Add a link
Reference in a new issue