Zum Inhalt springen
View in the app

A better way to browse. Learn more.

#T/N/X/T

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GetUserKey

Geschrieben

Zur Einweihung des neuen Forums stelle ich gleich mal eine Frage an die Entwickler.

 

Folgendes Skript habe ich im Netz gefunden und würde gern wissen, was sich der Entwickler beim Erstellen gedacht hat.

Die Datei nennt sich GetUserKey.mq4 und hat folgenden Inhalt:

 

#import "kernel32"
int GetComputerNameA(int & lpBuffer[],int & nSize[]);
#import

#property show_inputs
extern string UserName="Input Here Your Name";

int start(){
  if(!IsDllsAllowed()){
	 Alert("Allow DLL in MT options");
	 return(0);
  }
  int lpBuf[64];
  int nS[1];   
  nS[0]=256;
  
  int rv=GetComputerNameA(lpBuf,nS);
  if(rv==0){
	 Alert("Cant get computer name");
	 return(false);
  }	  
  string Text = "";   
  for(int i = 0; i<64; i++){
	 Text = Text + CharToStr(lpBuf[i] & 0x000000FF);
	 if(StringLen(Text) ==nS[0])break;
	 Text = Text + CharToStr(lpBuf[i] >> 8 & 0x000000FF);
	 if(StringLen(Text) ==nS[0])break;
	 Text = Text + CharToStr(lpBuf[i] >> 16 & 0x000000FF);
	 if(StringLen(Text) == nS[0])break;
	 Text = Text + CharToStr(lpBuf[i] >> 24 & 0x000000FF);
	 if(StringLen(Text) == nS[0])break;
  }
  
  int h=FileOpen("SaveItForYourSelf.txt",FILE_CSV|FILE_WRITE);
  FileWrite(h,"Write down the following data to your notepad");   
  FileWrite(h,"");	 
  FileWrite(h,"ComputerName: "+Text);
  FileWrite(h,"UserName: "+UserName);   
  FileClose(h);
  
  h=FileOpen("UserName.txt",FILE_CSV|FILE_WRITE);
  FileWrite(h,UserName);   
  FileWrite(h,"");	  
  FileWrite(h,"Dont delete this file");	
  
  FileClose(h);	  
  
  
  string DigitsText="";
  for(i=0;i<StringLen(Text);i++){
	 DigitsText=DigitsText+StringGetChar(Text,i);
  }   

  string s2=fCipheringDigitString(DigitsText,UserName,0);

  h=FileOpen("SendThisFile.txt",FILE_CSV|FILE_WRITE);
  FileWrite(h,"Send this file to the license seller");   
  FileWrite(h,"");	
  FileWrite(h,"User Key: "+s2);
  FileClose(h);
  
  Alert("See "+TerminalPath()+"\experts\files... SaveItForYourSelf.txt, SendThisFile.txt and UserName.txt");

  return(0);
}
 
string fCipheringDigitString(string aDigitString,string aKeyWord,int aFlag=0){//0-øèôðîâàíèå,1-ðàñøèôðîâêà
  string sKeyDigits="";
  for(int ti=0;ti<StringLen(aKeyWord);ti++){
	 sKeyDigits=sKeyDigits+StringGetChar(aKeyWord,ti);
  }
  int tKeyWordIndex=0;
  string RetString="";
  if(aFlag==0){
	 for(ti=0;ti<StringLen(aDigitString);ti++){
		int tDigit1=StrToInteger(StringSubstr(aDigitString,ti,1));
		int tDigit2=StrToInteger(StringSubstr(sKeyDigits,tKeyWordIndex,1));
		tDigit1+=tDigit2;
		   if(tDigit1>9){
			  tDigit1-=10;
		   }
		RetString=RetString+tDigit1;
		tKeyWordIndex++;
		   if(tKeyWordIndex>=StringLen(sKeyDigits)){
			  tKeyWordIndex=0;
		   }
	 }
  }
  else{
	 for(ti=0;ti<StringLen(aDigitString);ti++){
		tDigit1=StrToInteger(StringSubstr(aDigitString,ti,1));
		tDigit2=StrToInteger(StringSubstr(sKeyDigits,tKeyWordIndex,1));
		tDigit1-=tDigit2;
		   if(tDigit1<0){
			  tDigit1+=10;
		   }
		RetString=RetString+tDigit1;
		tKeyWordIndex++;
		   if(tKeyWordIndex>=StringLen(sKeyDigits)){
			  tKeyWordIndex=0;
		   }
	 }
  }
  return(RetString);
}

 

Copyright Info kann ich keine anhängen, da ich den Ersteller nicht kenne und er auch keine © in die Datei geschrieben hat.

 

 

Die *.mq4 muss ins Verzeichnis /Skript / kopiert werden. Ruft man diese nach dem Kompilieren auf, werden 3 Textfiles erzeugt, auf welche man dann im Ordner C:\Programme\Path to Metatrader\experts\files\ zugreifen kann.

 

SaveItForYourSelf.txt

 

Inhalt:

Write down the following data to your notepad

 

ComputerName: #

UserName: Input Here Your Name

 

SendThisFile.txt

 

Inhalt:

Send this file to the license seller

 

User Key: 51

 

UserName.txt

 

Inhalt:

Input Here Your Name

 

Dont delete this file

 

 

Soll das so etwas wie eine ganz einfache Version eines Lizenzfiles sein?

Featured Replies

Geschrieben

Ja, da wird ein Code aus dem Namen des Rechners und dem des Anwenders erzeugt und zurückgegeben.

 

Wahrscheinlich kommt ein EA vom Ersteller des Scripts dann mit diesem hardcodierten Code und läuft nur auf dem Rechner.

 

Lutz

Geschrieben
Ja, da wird ein Code aus dem Namen des Rechners und dem des Anwenders erzeugt und zurückgegeben.

 

Wahrscheinlich kommt ein EA vom Ersteller des Scripts dann mit diesem hardcodierten Code und läuft nur auf dem Rechner.

 

Lutz

Seh ich auch so.

Dein Kommentar

Du kannst jetzt schreiben und Dich später registrieren. Wenn Du ein Konto hast, melde Dich jetzt an, um unter Deinem Benutzernamen zu schreiben.

Gast
Auf dieses Thema antworten...

Account

Navigation

Suche

Suche

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.