![]() |
Internet verbindung Disconnecten?
Also bin grade dabei ein kleines Porg zu coden worum es geht einen Hackerangriff abzuwähren ... geht auch bisher alles prima nur iwie bekomm ich es nicht vernünfig geregelt das die internetconnection auf tastendruck abreist (Panikmodus) es soll ja nicht nur bei der einwahl von WIN XP funzen sondern auch vllt bei der einwahl von t-online aol und konsorten und danach soll auch noich ggf. die wan connection gekillt werden .... hab schon n "bissel" viel gesucht aber nix brauchbares gefunden kann mir da jemand helfen ??
THX |
Re: Internet verbindung Disconnecten?
Nimm mal das hier:
Delphi-Quellcode:
von x000x.
unit DropAllU;
{ Aufruf: InstallFW('192.168.0.2'); und zum schluss: RemoveFW; } interface procedure InstallFW(MyIP: String); procedure RemoveFW; implementation uses Windows; const IPHLPAPI = 'IPHLPAPI.DLL'; type PFFORWARD_ACTION = Integer; PPFFORWARD_ACTION = ^PPFFORWARD_ACTION; // INTERFACE_HANDLE = Pointer; // PFADDRESSTYPE = Integer; PPFADDRESSTYPE = ^PFADDRESSTYPE; // TByteArray = Array [0..Pred(MaxInt)] of Byte; PByteArray = ^TByteArray; TIpBytes = Array [0..3] of Byte; const PF_ACTION_DROP = 1; const PF_IPV4 = 0; function PfCreateInterface( dwName: DWORD; inAction: PFFORWARD_ACTION; outAction: PFFORWARD_ACTION; bUseLog: BOOL; bMustBeUnique: BOOL; var ppInterface: INTERFACE_HANDLE): DWORD; stdcall; external IPHLPAPI name '_PfCreateInterface@24'; function PfDeleteInterface( pInterface: INTERFACE_HANDLE): DWORD; stdcall; external IPHLPAPI name '_PfDeleteInterface@4'; function PfBindInterfaceToIPAddress( pInterface: INTERFACE_HANDLE; pfatLinkType: PFADDRESSTYPE; IPAddress: PByteArray): DWORD; stdcall; external IPHLPAPI name '_PfBindInterfaceToIPAddress@12'; function PfUnBindInterface( pInterface: INTERFACE_HANDLE): DWORD; stdcall; external IPHLPAPI name '_PfUnBindInterface@4'; var Handle_Interface : INTERFACE_HANDLE = nil; function StrToInt(S: PChar): Integer; begin Result := 0; if S = '' then Exit; while S^ in ['0'..'9'] do begin Result := Result * 10 + Integer(S^) - Integer('0'); Inc( S ); end; end; function StrToIpBytes( IpStr: String ): TIpBytes; var N : Integer; begin N := 0; while Pos('.', IpStr)>0 do begin Result[N] := StrToInt(@Copy(IpStr, 1, Pos('.', IpStr) - 1)[1]); Delete(IpStr, 1, Pos('.', IpStr)); Inc(N); end; Result[N] := StrToInt(@IpStr[1]); end; procedure InstallFW(MyIP: String); var IpLocal : TIpBytes; begin if (MyIP <> '') and Not Assigned(Handle_Interface) then begin FillChar(IpLocal, 4, #0); IpLocal := StrToIpBytes(MyIP); PfCreateInterface(0, PF_ACTION_DROP, PF_ACTION_DROP, False, False, Handle_Interface); PfBindInterfaceToIPAddress(Handle_Interface, PF_IPV4, @ipLocal); end; end; procedure RemoveFW; begin if Assigned(Handle_Interface) then begin PfUnBindInterface(Handle_Interface); PfDeleteInterface(Handle_Interface); Handle_Interface := nil; end; end; end. Zum aufrufen InstallFW(_local_ip_hier) und zum wiederherstellen RemoveFW. Ist also ne firewall die alle ports schliest. Hier noch was nettes um die lokale IP zu ermitteln:
Delphi-Quellcode:
von CalganX.
uses {...}, WinSock;
{...} function LocalIP:string; var WSA : TWSAData; ILen : integer; PHst : PChar; PHEn : PHostEnt; begin WSAStartup( $0101, WSA ); ILen := $FF; PHst := StrAlloc( ILen ); gethostname( PHst, ILen ); PHEn := gethostbyname( PHst ); with PHEn^ do result:=format( '%d.%d.%d.%d', [ord(h_addr^[ 0 ]), ord(h_addr^[ 1 ]), ord(h_addr^[ 2 ]), ord(h_addr^[ 3 ])] ); {Nuke the string} StrDispose( PHst ); {Dust and Clean} WSACleanup; end; Für hotkeys nimmst du am besten einen Timer mit interval 50 oder so.
Delphi-Quellcode:
Sonst empfehle ich
procedure TForm1.Timer1Timer(Sender: TObject);
begin if Odd(GetAsyncKeyState(Vk_F1)) then begin end; end; ![]() |
Re: Internet verbindung Disconnecten?
Er will die Internetverbindung trennen und nicht die Ports sperren...
|
Re: Internet verbindung Disconnecten?
Bei den Schweizern habe ich dies hier gefunden:
![]() [OT] Manuel muss einen ausgeben (4444 Beiträge) :mrgreen: [/OT] |
Re: Internet verbindung Disconnecten?
Zitat:
|
Re: Internet verbindung Disconnecten?
Evtl. wäre es möglich, aus dem Programm heraus alle Netzwerktreiber bzw. Netzwerkverbindungen zu deaktivieren.
Vielleicht hift dir ![]() MfG, Bug |
Re: Internet verbindung Disconnecten?
soo will euch ma berichten leider kann (darf) ich den src nicht veröffendlichen .... gelöst hab ich das wie folgt
-alle ports schließen -mit der schweizer methode ^^ alle connections disconnecten -und dann noch die netzwerkkomponenten über die treiber deaktiviern wenn eins davon fehlschlägt sag ich nur ATX PowerOff ... etwas rabiat aber was will man machen ?! |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:07 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz