Re: Security Software
Zitat:
Nun noch zum Thema: versuch mal Deinem Quelltext bissl Form zugeben.."einruecken Begin End etc." macht es uebersichtlicher und Fehler lassen sich auch besser finden. |
Re: Security Software
Die Batch soll ja laufend nach dem Taskmanager suchen und ihn beenden.
Code:
Was ist an GoTo´s eigentlich so schlimm?
:anfang
taskkill /im taskmgr.exe GoTo anfang |
Re: Security Software
Hi,
ich hab´dir mal den Code etwas formatiert... Dann hat man bessere Übersicht, weiß wo ein begin anfängt und wo das dazugehörige end steht etc. Das mit dem goto ist ein no-go :lol: Wird im allgemeinen als schlechter Programmierstil angesehen, weil der Programmfluss nicht mehr so einfach zu durchschauen ist. Versuch doch mal, das Programm in einzelne Prozeduren/Funktionen zu unterteilen. Dann wird der Hauptteil übersichtlicher und du brauchst (hoffentlich) keine goto´s mehr :wink:
Delphi-Quellcode:
program Security1Beta;
{$APPTYPE CONSOLE} uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, shellapi; var Passwort, compname, test: String; Wrongcount: Integer = 0; label anfang, ende, EnterComputerName; begin if DirectoryExists(test+'_Desktop') then WrongCount := 4; anfang: Write('Please enter Password to access: '); ReadLn(Passwort); writeln; if (passwort = 'passwort1') and (wrongcount < 4) then begin writeln('Access...'); goto ende; end else if wrongcount < 4 then begin writeln('Access denied!!! You can try one more.'); inc(wrongcount); end else begin writeln('Access to all functions of the program will be blocked...'); writeln('Another entering the password is no longer possible.'); EnterComputerName: CreateDir(test+'_Desktop'); writeln('Please identify yourself as the owner of this computer.'); writeln; write('Please enter the computer name: '); ReadLn(compname); if compname = GetEnvironmentVariable('USERDOMAIN') then begin writeln; writeln('Computer name is checked...'); writeln; writeln('Computer name confirmed.'); RemoveDir(test+'_Desktop'); wrongcount:= 0; writeln; goto anfang; end else begin writeln; writeln('Computer name is checked...'); writeln; writeln('Wrong input.'); writeln('Full closure is initialized...'); writeln('Full closure in Progress...'); CreateDir(test+'_Lokale Einstellungen'); writeln('Full closure complete.'); goto EnterComputerName end; end; writeln; goto anfang; ende: writeln; write('To end the program press enter.'); ReadLn; end. |
Re: Security Software
du kannst auch ne menge units aus deinem programm verbannen, um die datei grösse zu reduzieren...
du verwendest eh keine befehle aus diesen units... hab sie mal markiert:
Delphi-Quellcode:
program Security1Beta;
{$APPTYPE CONSOLE} uses Windows, SysUtils; // das sind die einzigen verwendeten units, der rest ist nicht in verwendung // das verringert deine dateigrösse von rund 361kb auf rund 43kb // Messages, // Variants, // Classes, // Graphics, // Controls, // Forms, // Dialogs, // StdCtrls, // shellapi; var Passwort, compname, test: String; Wrongcount: Integer = 0; label anfang, ende, EnterComputerName; begin if DirectoryExists(test+'_Desktop') then WrongCount := 4; anfang: Write('Please enter Password to access: '); ReadLn(Passwort); writeln; if (passwort = 'passwort1') and (wrongcount < 4) then begin writeln('Access...'); goto ende; end else if wrongcount < 4 then begin writeln('Access denied!!! You can try one more.'); inc(wrongcount); end else begin writeln('Access to all functions of the program will be blocked...'); writeln('Another entering the password is no longer possible.'); EnterComputerName: CreateDir(test+'_Desktop'); writeln('Please identify yourself as the owner of this computer.'); writeln; write('Please enter the computer name: '); ReadLn(compname); if compname = GetEnvironmentVariable('USERDOMAIN') then begin writeln; writeln('Computer name is checked...'); writeln; writeln('Computer name confirmed.'); RemoveDir(test+'_Desktop'); wrongcount:= 0; writeln; goto anfang; end else begin writeln; writeln('Computer name is checked...'); writeln; writeln('Wrong input.'); writeln('Full closure is initialized...'); writeln('Full closure in Progress...'); CreateDir(test+'_Lokale Einstellungen'); writeln('Full closure complete.'); goto EnterComputerName end; end; writeln; goto anfang; ende: writeln; write('To end the program press enter.'); ReadLn; end. eine frage aber noch: wozu soll dieses programm genau sein, und was hat das mit sicherheit zu tun?? |
Re: Security Software
Außerdem solltest du bedenken, dass man die Zeile
Delphi-Quellcode:
mit jedem guten Disassembler auslesen kann und somit das Passwort in Null Komma nichts herausfinden kann!
{...} if (passwort = 'passwort1') {...}
|
Re: Security Software
Zitat:
|
Re: Security Software
Zitat:
mit disasm kann er sich dann später einfriemeln ... |
Re: Security Software
@ lbccaleb:
Haste natürlich recht! Klar muss man nicht alles perfekt sein. Mein Vorschlag war für die weiterführende Arbeit. Sozusagen für Version 2 :-D |
Re: Security Software
Wie kann man es denn Verhindern, dass das Passwort eingelesen werden kann?
|
Re: Security Software
Du müsstest es verschlüsseln oder irgendwie außerhalb des Kompilats ablegen oder besser beides.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 15:51 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz