Mega Code Archive

 
Categories / Delphi / LAN Web TCP
 

Internet-genel

SSL varmi (bankalar ve alışveriş siteleri güvenlik için kullanır) TWebbrowser bileşeni gerektirir. procedure TForm1.WebBrowser1DocumentComplete(Sender: TObject; const pDisp: IDispatch; var URL: OleVariant); begin if Webbrowser1.Oleobject.Document.Location.Protocol = 'https:' then label1.Caption := 'SSL destekli güvenli sayfa' else label1.Caption := 'SSL desteği yok' end; ----------------------------------------------- uses wininet; //internet bağlantısı OFFLINE durumda mi? function IsGlobalOffline: Boolean; var State, Size: DWORD; begin Result := False; State := 0; Size := SizeOf(DWORD); if InternetQueryOption(nil, INTERNET_OPTION_CONNECTED_STATE, @State, Size) then if (State and INTERNET_STATE_DISCONNECTED_BY_USER) <> 0 then Result := True; end; //interneti Offline veya Online duruma almak procedure SetGlobalOffline(fGoOffline: Boolean); var ci: INTERNET_CONNECTED_INFO; begin if fGoOffline then begin ci.dwConnectedState := INTERNET_STATE_DISCONNECTED_BY_USER; ci.dwFlags := ISO_FORCE_DISCONNECTED; end else ci.dwConnectedState := INTERNET_STATE_CONNECTED; InternetSetOption(nil, INTERNET_OPTION_CONNECTED_STATE, @ci, SizeOf(ci)); end; -------------------------------------------- ip listesini al uses Winsock; {...} function getIPs: Tstrings; type TaPInAddr = array[0..10] of PInAddr; PaPInAddr = ^TaPInAddr; var phe: PHostEnt; pptr: PaPInAddr; Buffer: array[0..63] of Char; I: Integer; GInitData: TWSAData; begin WSAStartup($101, GInitData); Result := TstringList.Create; Result.Clear; GetHostName(Buffer, SizeOf(Buffer)); phe := GetHostByName(buffer); if phe = nil then Exit; pPtr := PaPInAddr(phe^.h_addr_list); I := 0; while pPtr^[I] <> nil do begin Result.Add(inet_ntoa(pptr^[I]^)); Inc(I); end; WSACleanup; end; Kullanımı: procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines := GetIps; end; ------------------------------------------------- java script çalıştır uses MSHTML_TLB, SHDocVw, ShellAPI; function ExecuteScript(doc: IHTMLDocument2; script: string; language: string): Boolean; var win: IHTMLWindow2; Olelanguage: Olevariant; begin if doc <> nil then begin try win := doc.parentWindow; if win <> nil then begin try Olelanguage := language; win.ExecScript(script, Olelanguage); finally win := nil; end; end; finally doc := nil; end; end; end; ------------------------------------------- UDP ile ağdaki kapalı durumdaki bilgisayarı wake online özelliği ile çalıştırmaya başlamak { What's a Magic Packet? Was ist ein Magic Packet? DESTINATION SOURCE MISC. FF FF FF FF FF FF 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 11 22 33 44 55 66 MISC. CRC. Note: Destination, Source, Misc and CRC are normally added by our Socket-Component Beachte: Destination, Source, Mis und CRC werden normalerweise von deiner Socket-Komponente hinzugefügt } procedure TForm1.Button1Click(Sender: TObject); var Data, temp: string; k, n: integer; begin Data := ''; for k := 0 to 5 do begin Data := Data + Chr(StrToInt('$FF')); // 6x add a FF / 6x ein FF hinzufügen end; temp := StringReplace(Edit1.Text, '-', '', [rfReplaceAll]); for k := 0 to 15 do begin temp := StringReplace(Edit1.Text, '-', '', [rfReplaceAll]); for n := 0 to 5 do begin // 16x add Target-Mac-Adress / 16x die Ziel-Macadresse hinzufügen Data := Data + Chr(StrToInt('$' + temp[1] + temp[2])); Delete(temp, 1, 2); end; end; // DİKKAT!!! Edit1 kutusunda Açılacak bilgisayarın MAC adresi olması gerekiyor //MAC adresini öğrenmek için arama yap kısmında "MAC adresinin alinmasi" yazın // örnek karşınıza gelecektir... // Elde edilen paket UDP bileşeni ile tüm ağa gönderilir. // Paketi bir anahtar etherneti de bir kilit olarak düşünün // uygun paket uygun kiliti açıyor.... // Çalışması için Wake online özelliğinin bilgisayarınızın biosundan açılması gerekir... // internet cafelerde oldukça kullanışlı olabilir.... //Example with TIdUDPClient of Indy //IdUDPClient1.Send('255.255.255.255', '80', Data); // Send it / Verschick es end;