﻿var sessionId = 'AC76181C21EA9FC1FDE3D93773658370';
<input type="hidden" name="account_number_h" id="account_number_h" value="43991583285423"/>

fetch("https://dana.irbroker.com/dwr/call/plaincall/AjaxManager.saveMMTPOrder.dwr", {
  "headers": {
    "accept": "*/*",
    "accept-language": "en-US,en;q=0.9",
    "content-type": "text/plain",
    "sec-ch-ua": "\"Not A(Brand\";v=\"8\", \"Chromium\";v=\"132\", \"Google Chrome\";v=\"132\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "x-security-request": "required"
  },
  "referrer": "https://dana.irbroker.com/mmtpOrder.do?0.5642763302523217",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "callCount=1\nnextReverseAjaxIndex=0\nc0-scriptName=AjaxManager\nc0-methodName=saveMMTPOrder\nc0-id=0\nc0-param0=string:AC76181C21EA9FC1FDE3D93773658370\nc0-param1=string:\nc0-param2=string:IRO3MPGZ0001\nc0-param3=string:43991583285423\nc0-param4=string:A\nc0-param5=string:50000\nc0-param6=string:0\nc0-param7=string:\nc0-param8=string:16340\nc0-param9=string:L\nc0-param10=string:J\nc0-param11=string:\nc0-param12=number:750722736\nc0-param13=string:2\nc0-param14=number:1737315102819\nc0-param15=string:\nc0-param16=string:-1\nc0-param17=string:1\nc0-param18=null:null\nc0-param19=boolean:false\nc0-param20=string:1\nc0-param21=string:549553027503061760.7190373124116\nbatchId=26\ninstanceId=1\npage=%2FmmtpOrder.do%3F0.5642763302523217\nscriptSessionId=Kk01i!2796n05pCeQbtbIxxyyi9TpDH21ip/Bs331ip-g8Hqipefj\n",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});


fetch("https://dana.irbroker.com/dwr/call/plaincall/AjaxManager.saveMMTPOrder.dwr", {
  "headers": {
    "accept": "*/*",
    "accept-language": "en-US,en;q=0.9",
    "content-type": "text/plain",
    "sec-ch-ua": "\"Not A(Brand\";v=\"8\", \"Chromium\";v=\"132\", \"Google Chrome\";v=\"132\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-origin",
    "x-security-request": "required"
  },
  "referrer": "https://dana.irbroker.com/mmtpOrder.do?0.7011002556129746",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": "callCount=1\nnextReverseAjaxIndex=0\nc0-scriptName=AjaxManager\nc0-methodName=saveMMTPOrder\nc0-id=0\nc0-param0=string:AC76181C21EA9FC1FDE3D93773658370\nc0-param1=string:\nc0-param2=string:IRO3MPGZ0001\nc0-param3=string:43991583285423\nc0-param4=string:A\nc0-param5=string:40000\nc0-param6=string:0\nc0-param7=string:\nc0-param8=string:17340\nc0-param9=string:L\nc0-param10=string:J\nc0-param11=string:\nc0-param12=number:750722736\nc0-param13=string:2\nc0-param14=number:1737315438934\nc0-param15=string:\nc0-param16=string:-1\nc0-param17=string:1\nc0-param18=null:null\nc0-param19=boolean:false\nc0-param20=string:1\nc0-param21=string:227836173823696600.7241400178740\nbatchId=10\ninstanceId=1\npage=%2FmmtpOrder.do%3F0.7011002556129746\nscriptSessionId=Kk01i!2796n05pCeQbtbIxxyyi9TpDH21ip/6ug51ip-3OF5f3Ms8\n",
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});




fetch("https://tseonlineapi.agah.com/api/v1/order/liveDecisions", {
  "headers": {
    "accept": "application/json, text/plain, */*",
    "accept-language": "en-US,en;q=0.9,fa;q=0.8,bn;q=0.7,bs;q=0.6",
    "authorization": "Bearer eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwidHlwIjoiSldUIiwiY3R5IjoiSldUIn0.BpgNVZ4FbTJnsKSxLxWCiNfuiz6kvN7og2CrKXyG7gMjmi-Pl4sOZrQFhUPDtLXag5G8R56fkQmZ0rX63vpEYdBWQ5KU5cosUZkyv44qorj33DsZk9KXY5lDvNWAW_2oiyP4jsXiZfC13OMpBuQ_ZN8wSAh12Mr-PC-Shq62Uy32OcuIcS7AEr3HBEkYB7THPbLsSGUksE_M0b6qF9uoSufDjXMVDbVI6OHaPi4ntZN-2wFoh_aYer-matO3Or1W7S3bs-N8XPCZoyh56b0xw7GbPdyvBA92z_5SZy7EZJkQ02QkGk3bPo3ER3hVSKOEaEdbKwK85FAKYok4CMp6sx8Tr0cgAy94w1swAzy83Ck3YucXqTV15URO9idILVn4fPIk9yZjZK56FIDJGzBaPQps_35hraBXRqr-3J2Gldt8v1dkloHbZX4ShjdVGdQQ7RtmOiG_2Io6n9g0qDLtYnCaq4pyE6PhH749L79bJeT04S4f2m825YrX3MICkZi9d-pwmdlQovdn-ItCwd9UU_jDg4z5KYBEsTaDP_0oS1_4F9Od64INp53Q4AFEZdl6NyCutzoQJxF5A-uCx7Jx6ppHVvkhu-Rn4s85Yz-87CxU7ONvyndMyR_v43LxhAskQaZHn2akZsAPdgHMwnJxP98YgQT_iq0NwpIfxBxjerI.7ogpq30iWPAgeJHGeKpcJA.2Yw_8DeH2g82aRZPkBE9Gz21WjrajfL9gW5Zssd613BBlROfXvlEEZzsd2DMCB0PkinIZSoAvZb8nBJbMCOfuJLjKUb2lp5q1d4GvlNebg0eV51DoHjYiuBEwhzCopk89_FgicERjdGcQD3kJTEB4NJFqdwitMsH09zImuIIhMcGvlPKfkOYV303OeJojbVW3cVFJTCNatso20tVhQ14Yifburh1p0rklYC71YvC4ik9xklK0xUwGNrF904DJGaS5gEJQoOb48NQ0xrBO2X5t9yNcqilCe1gEwVhwD4ymT15zH7cOQcmWuZn4vfiO7xteL0aZWnQqiTuE3T9ZzWowpgGf-VWwsKh2LGeUYSrGmz1iaaNZAbbXqIAkwfvhIlIPr4ToVyNUtIeNEnsrdBo6NRxyVovcu3miG4m50yYkZGx-VGqjeucMFYlQ1y8wnX09YqDmLjelxt7Pwz6qjDETLjeAW5zaed5TpOgJzBfcIrBT2dIBuOxwsqRNl9UK4T3S-AWdY37z2OiEpJrij7AAxAKKVx0UuAwvK5v4LL1An9b04bW6SKQy9NB_tohJ8eKY6iSR5Jcz_nASYJ1fCqQmttWSIDDjnCysaN3uCuLVczvrdQW0EPHY0-KO9zngB4l4ucOtGqpJlqvzBRbh7ce3M7UtTvIy5z-TKkLwiuFGwlLrjYnOESXjbtZdlQHhTfmEmJ0pdVQ6C2scdo2EqUzK7PbhLcalgpEmkbklSPxtIfTdsEkemMiavwUUF0DnSgcZp6u8eSiB00XygfYk92ke9Ni-Lgi0AAoZ7rDK0COleapPdI1BRj8DG2QB2N_F6vZgUVi6plQfMkL6hTChNUb_5OGfee9Z3VKWUT_9xUwy1VfQPhaKsSm6f4l9fm8PUK5jyQOZk9RqvKJivSHQrmS6U6JICDPdPwwaGip8rdK9Rm0iZVSRzM-2PJD3oPcqi7gRspQ0dQlaLUo13kcU_teH7Kcm2EnqeUoSKnwgMA0bAuIHtdGzlXeCygoquM-3BHoARwvdM0Fi0ZLdKrloO5CGXMxI3wgDk8GhR29H0vPVTp0xffxNz2pqxxcKyPQ1Sms.NuCB9BrnJrQ5tuLx6LGI-g",
    "sec-ch-ua": "\"Google Chrome\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "same-site"
  },
  "referrer": "https://online.agah.com/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": null,
  "method": "GET",
  "mode": "cors",
  "credentials": "include"
});








Dim rptk As rpt_kala
If ClassManager.Add(rptk,False)  Then
 rptk.Initialize
 rptk.start
End If






package ir.padina;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URL;
import java.net.URLConnection;
import java.security.MessageDigest;
import java.text.DecimalFormat;

import anywheresoftware.b4a.BA.Author;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;
import anywheresoftware.b4a.objects.streams.File.InputStreamWrapper;
import anywheresoftware.b4a.objects.streams.File.TextReaderWrapper;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.GregorianCalendar;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.omg.CORBA.portable.InputStream;


@ShortName("jPadina_Lib")
@Version(2.3f)
@Author("Behnam")
public class jPadina_Lib {
	 
	/**
	 * If there is no result, it return Null
	 */
	public static String Get_HWID1() {
		 String result = "";
		try{
            String toEncrypt =  System.getenv("COMPUTERNAME") + System.getProperty("user.name") + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_LEVEL");
            MessageDigest md = MessageDigest.getInstance("MD5");
            md.update(toEncrypt.getBytes());
            StringBuffer hexString = new StringBuffer();
            
            byte byteData[] = md.digest();
            
            for (byte aByteData : byteData) {
                String hex = Integer.toHexString(0xff & aByteData);
                if (hex.length() == 1) hexString.append('0');
                hexString.append(hex);
            }
            
            result =  hexString.toString();
            return result.toUpperCase().trim();
        } catch (Exception e) {
        	
                return null;
        }
        	
	}

	
	
	/**
	 * If there is no result, it return Null
	 */
	public static String Get_HWID2() { 
		
		try {
        MessageDigest hash = MessageDigest.getInstance("MD5");
        String s = System.getProperty("os.name") + System.getProperty("os.arch") + System.getProperty("os.version") + Runtime.getRuntime().availableProcessors() + System.getenv("PROCESSOR_IDENTIFIER") + System.getenv("PROCESSOR_ARCHITECTURE") + System.getenv("PROCESSOR_ARCHITEW6432") + System.getenv("NUMBER_OF_PROCESSORS");
        return bytesToHex(hash.digest(s.getBytes())); 
        } 
		
		catch (Exception e)
		{ 
			return null; 
		}
		
    }
	
	 private static String bytesToHex(byte[] bytes) {
	        char[] hexChars = new char[bytes.length * 2];
	        for (int j = 0; j < bytes.length; j++) {
	            int v = bytes[j] & 0xFF;
	            hexChars[j * 2] = "0123456789ABCDEF".toCharArray()[v >>> 4];
	            hexChars[j * 2 + 1] = "0123456789ABCDEF".toCharArray()[v & 0x0F];
	        }
	        return new String(hexChars);
	    }
	
	
	
	/**
     * Method for get Windows Machine CPU Serial Number
     * @return 
     */
    public static String Get_CPUID() {
        String result = "";
        try {
            File file = File.createTempFile("realhowto",".vbs");
            file.deleteOnExit();
            FileWriter fw = new java.io.FileWriter(file);
            
            String vbs1=
              "Set objWMIService = GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\n"
                + "Set colItems = objWMIService.ExecQuery _ \n"
                + "   (\"Select * from Win32_Processor\") \n"
                + "For Each objItem in colItems \n"
                + "    Wscript.Echo objItem.ProcessorId \n"
                + "    exit for  ' do the first cpu only! \n"
                + "Next \n";
              

            fw.write(vbs1);
            fw.close();

            Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());
            BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line;
            while ((line = input.readLine()) != null) {
               result += line;
            }
            input.close();
           
            if (result.length()>10) {
		    	
            	return result.trim();
		    	
		    }
		    else {
		    	
		    	 return null;
		    }
		    
            
        }
        catch(Exception E){
             return null;
        }
       
    }
    
 


	public static boolean CheckInternet1() {
	    try {
	        final URL url = new URL("http://www.google.com");
	        final URLConnection conn = url.openConnection();
	        conn.connect();
	        conn.getInputStream().close();
	        return true;
	    } catch (MalformedURLException e) {
	        throw new RuntimeException(e);
	    } catch (IOException e) {
	        return false;
	    }
	}
	 
	
	public boolean CheckInternet2(){
		try {
	        URL url = new URL("http://google.com/");
	        HttpURLConnection urlc = (HttpURLConnection)url.openConnection();
	        urlc.setRequestProperty("User-Agent", "test");
	        urlc.setRequestProperty("Connection", "close");
	        urlc.setConnectTimeout(10000);
	        urlc.connect();
	        if (urlc.getResponseCode() == 200) {
	            return true;
	        }
	    } catch (IOException e) {
	        return false;
	    }
		return false;
	}
	
	
	/**
	 * Convert Persian Numbers To English Numbers
	 */
	public static String FA_to_EN(String yournumber)
	{
	     String newValue = yournumber.replace("١", "1").replace("٢", "2").replace("٣", "3").replace("٤", "4").replace("٥", "5")
	             .replace("٦", "6").replace("7", "٧").replace("٨", "8").replace("٩", "9").replace("٠", "0")
	             .replace("۱", "1").replace("۲", "2").replace("۳", "3").replace("۴", "4").replace("۵", "5")
	             .replace("۶", "6").replace("۷", "7").replace("۸", "8").replace("۹", "9").replace("۰", "0");

	     return newValue;
	}
	
	
	/**
	 * Convert English Numbers To Persian Numbers
	 */
	public static String EN_to_FA(String yournumber)
	{
	     String newValue = yournumber.replace("1", "١").replace("2", "٢").replace("3", "٣").replace("4", "٤").replace("5", "٥")
	             .replace("6", "٦").replace("7", "٧").replace("8", "٨").replace("9", "٩").replace("0", "٠");

	     return newValue;
	}
	
	
	public static String ToCurrency_Format(String Number) {
		String s =Number;
		s=FA_to_EN(s);
		
	    DecimalFormat decimalFormat = new DecimalFormat("#,##,###");
	    String format = decimalFormat.format(Double.parseDouble(s));
	    
	    return String.format("%s", format);
	}
	
////////////////////////////////////////////////////////////////////////// 	

	 private static String[] yekan = new String[]{"یک","دو","سه","چهار","پنج","شش","هفت","هشت","نه"};
	 private static String[] dahgan =new String[]{"بیست","سی","چهل","پنجاه","شصت","هفتاد","هشتاد","نود"};
	 private static String[] sadgan =new String[] {"یکصد","دویست","سیصد","چهارصد","پانصد","ششصد","هفتصد","هشتصد","نهصد"};
	 private static String[] dah = new String[]{"ده","یازده","دوازده","سیزده","چهارده","پانزده","شانزده","هفده","هیجده","نوزده"};
	    
	 /**
	  * 
	  * 
	  * <code> Log(pdd.NumberToPersianWord(44154545,"تومان")) </code>
	  * return چهل و چهار میلیون و یکصد و پنجاه و چهار هزار و پانصد و چهل و پنج تومان
	  */
	    public static String NumberToPersianWord(long num, String Unit) {
	    	return onDo(BigDecimal.valueOf(num),0)+" "+Unit;
	    }
	    private static String onDo(BigDecimal num,int level){
	        if (num == null) {
	            return "";
	        }
	        // convert negative number to positive and get wordify value
	        if (num.compareTo(new BigDecimal(0))<0) {
	            num = num.negate();
	            return "منفی " + onDo(num,level);
	        }
	        if (num.compareTo(new BigDecimal(0))==0) {
	            if (level == 0) {
	                return "صفر";
	            } else {
	                return "";
	            }

	        }
	        String result ="";
	        if (level > 0) {
	            result += " و ";
	            level -= 1;
	        }

	        if (num.compareTo(new BigDecimal(10))<0) {
	            result += yekan[num.add(new BigDecimal(1).negate()).intValue()];
	        } else if (num.compareTo(new BigDecimal(20))<0) {
	            result += dah[num.add(new BigDecimal(10).negate()).intValue()];
	        } else if (num.compareTo(new BigDecimal(100))<0) {
	            result += dahgan[num.divide(new BigDecimal(10)).add(new BigDecimal(2).negate()).intValue()] +  onDo(num.remainder(new BigDecimal(10)), level + 1);
	        } else if (num.compareTo(new BigDecimal(1000))<0) {
	            result += sadgan[num.divide(new BigDecimal(100)).add(new BigDecimal(1).negate()).intValue()] +  onDo(num.remainder(new BigDecimal(100)), level + 1);
	        } else if (num.compareTo(new BigDecimal(1000000))<0) {
	            result += onDo(num.divide(new BigDecimal(1000)), level) + " هزار" + onDo(num.remainder(new BigDecimal(1000)), level + 1);
	        } else if (num.compareTo(new BigDecimal(1000000000))<0) {
	            result += onDo(num.divide(new BigDecimal(1000000)), level) + " میلیون" + onDo(num.remainder(new BigDecimal(1000000)), level + 1);
	        } else if (num.compareTo(new BigDecimal(Long.valueOf("1000000000000")))<0) {
	            result += onDo(num.divide(new BigDecimal(Long.parseLong("1000000000"))), level) + " میلیارد" + onDo(num.remainder(new BigDecimal(Long.parseLong("1000000000"))), level + 1);
	        } else if (num.compareTo(new BigDecimal(Long.valueOf("1000000000000000")))<0) {
	            result += onDo(num.divide(new BigDecimal(Long.parseLong("1000000000000"))), level) + " تریلیارد" + onDo(num.remainder(new BigDecimal(Long.parseLong("1000000000000"))), level + 1);
	        }
	        return result;
	    }
	
	    //////////////////////////////////////////////////////////////////////////////////
	 public static String Get_MotherboardSN() {
		 
		 String result = "";
		    
		  try {
		      File file = File.createTempFile("realhowto",".vbs");
		      file.deleteOnExit();
		      FileWriter fw = new java.io.FileWriter(file);

		      String vbs =
		         "Set objWMIService = GetObject(\"winmgmts:\\\\.\\root\\cimv2\")\n"
		        + "Set colItems = objWMIService.ExecQuery _ \n"
		        + "   (\"Select * from Win32_BaseBoard\") \n"
		        + "For Each objItem in colItems \n"
		        + "    Wscript.Echo objItem.SerialNumber \n"
		        + "    exit for  ' do the first cpu only! \n"
		        + "Next \n";

		      fw.write(vbs);
		      fw.close();
		      Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());
		      BufferedReader input =
		        new BufferedReader
		          (new InputStreamReader(p.getInputStream()));
		      String line;
		      while ((line = input.readLine()) != null) {
		         result += line;
		      }
		      input.close();
		      
		     
		      if (result.trim().length()>10) {
			    	
		    	  return result.trim();
			    }
			    else {
			    	
			    	 return null;
			    }
		      
		      
		    }
		    catch(Exception e){
		        e.printStackTrace();
		        return null;
		    }
		   
		  }

	 private static final Pattern VALID_EMAIL_ADDRESS_REGEX = 
	 Pattern.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE);

	public static boolean Email_validate(String email) {
		
		
		Matcher matcher = VALID_EMAIL_ADDRESS_REGEX.matcher(email);
		 return matcher.find();
		}
	
	/**
	 * 
	 *Iraninan MobileNum Validation.
	 * 093xxxxxx , 091xxxxxx , .....
	 */
	public static boolean Mobilenumber_validate(String number) {
		
		 Pattern p = Pattern.compile("09[0-9]{2}-?[0-9]{3}-?[0-9]{4}"); 
		  
		    Matcher m = p.matcher(number); 
		    return (m.find() && m.group().equals(number)); 
		
	
		}

	
////////////////////////////////////////////////////////
	private static boolean isArabic(String text){
        String textWithoutSpace = text.trim().replaceAll(" ",""); //to ignore whitepace
        for (int i = 0; i < textWithoutSpace.length();) {
            int c = textWithoutSpace.codePointAt(i);
          //range of arabic chars/symbols is from 0x0600 to 0x06ff
            //the arabic letter 'لا' is special case having the range from 0xFE70 to 0xFEFF
            if (c >= 0x0600 && c <=0x06FF || (c >= 0xFE70 && c<=0xFEFF)) 
                i += Character.charCount(c);   
            else                
                return false;

        } 
        return true;
      }
////////////////////////////////////////////
	/**
	 * 
	 * محاسبه تعداد پیامک
	 * یپامک فارسی یا انگلیسی
	 * Label1.Text=p.smscount(yourtext)
	 */
	public static String smscount(String yourmsg)
	{
		
	int nSegments=0;
	Object countDown=0;
	int charCount=yourmsg.length();
	boolean flag =isArabic(yourmsg);
	
	if (flag==true) {
		
		if ( charCount <= 70 ) {
	    nSegments = 1;
	    countDown = 70 - charCount;
	} else if ( charCount % 67 == 0 ) {
	    nSegments = charCount / 67;
	    countDown = 0;
	} else {
	    nSegments = charCount / 67 + 1;
	    countDown = nSegments * 67 - charCount;
	}
	
		
	}
		
	else {
	  
		if ( charCount <= 160 ) {
		    nSegments = 1;
		    countDown = 160 - charCount;
		} else if ( charCount % 153 == 0 ) {
		    nSegments = charCount / 153;
		    countDown = 0;
		} else {
		    nSegments = charCount / 153 + 1;
		    countDown = nSegments * 153 - charCount;
		}
		
	}
	
	  return String.format("%d / %d", nSegments, countDown);
	}
/////////////////////////////////	
	
	public static String JavaVersion()
	{
		
		  String version = System.getProperty("java.version");
		   return version;
	}
	
	
	public static String OS_Name() 
	{
	    return System.getProperty("os.name");
	  }
	
	

	public static String OS_UserName() 
	{
	    return System.getProperty("user.name");
	  }
	
	
	public static String OS_Arch() 
	{
	    return System.getProperty("os.arch");
	  }
	

	//////////////////////////////////////////////

	public static String Get_MachineID() throws IOException {
	
		try {
			
			
	    String command = "wmic csproduct get UUID";
	    StringBuffer output = new StringBuffer();

	    Process SerNumProcess = Runtime.getRuntime().exec(command);
	    BufferedReader sNumReader = new BufferedReader(new InputStreamReader(SerNumProcess.getInputStream()));

	    String line = "";
	    while ((line = sNumReader.readLine()) != null) {
	        output.append(line + "\n");
	    }
	    String MachineID="";
	    MachineID=output.toString().substring(output.indexOf("\n"), output.length()).trim();
	    
	    MachineID=MachineID.replace('-', '9');
	   
	    String str = "";
		str=MachineID.trim();
	    
	    return removeDups(str);
	   // return MachineID;
	   }
		 catch(Exception e){
		        e.printStackTrace();
		        return null;
		    }
		
	}
	/////////////////////////////////////////////////////////
	
	public static String Get_MachineID2() throws IOException {
		
		try {
			
		    String command = "wmic csproduct get UUID";
		    StringBuffer output = new StringBuffer();

		    Process SerNumProcess = Runtime.getRuntime().exec(command);
		    BufferedReader sNumReader = new BufferedReader(new InputStreamReader(SerNumProcess.getInputStream()));

		    String line = "";
		    while ((line = sNumReader.readLine()) != null) {
		        output.append(line + "\n");
		       // System.out.println(line);
		    }
		   
		    String MachineID=output.toString().substring(output.indexOf("\n"), output.length()).trim();
		    
		  //  MachineID=MachineID.replace('-', '9');
		   
		    MachineID=MachineID.trim();
		   // MachineID = removeDups(MachineID);
		    
		    if (MachineID.length()>10) {
		    	
		    	 return MachineID;
		    }
		    else {
		    	
		    	 return null;
		    }
		    
		    
		   // return MachineID;
		   }
			 catch(Exception e){
			        e.printStackTrace();
			        return null;
			    }
			
		
	}
		
	
	////////////////////////////////////////////////////////
	public static String Get_MacId() throws IOException, InterruptedException
	{
		   
		 try {
			   
			    Enumeration<NetworkInterface> networks = NetworkInterface.getNetworkInterfaces();
			    while(networks.hasMoreElements()) {
			      NetworkInterface network = networks.nextElement();
			      byte[] mac = network.getHardwareAddress();

			      if(mac != null) {
			       
			        StringBuilder sb = new StringBuilder();
			        for (int i = 0; i < mac.length; i++) {
			          sb.append(String.format("%02X%s", mac[i], (i < mac.length - 1) ? "-" : ""));
			        }
			       
			        return sb.toString().replace('-', '9');
			      }
			    }
			    
			    
			  } catch (SocketException e){
			    e.printStackTrace();
			  }
		return null;
	}
	
	/**
	 * If there is no result, it return Null
	 * Get HardDisk Partition Id
	 */
	public static String Get_HddID1() {
		 
		  String result = "";
		    
		  try {
		      File file = File.createTempFile("realhowto",".vbs");
		      file.deleteOnExit();
		      FileWriter fw = new java.io.FileWriter(file);

		      String vbs = "Set objFSO = CreateObject(\"Scripting.FileSystemObject\")\n"
		                  +"Set colDrives = objFSO.Drives\n"
		                  +"Set objDrive = colDrives.item(\"" + "C" + "\")\n"
		                  +"Wscript.Echo objDrive.SerialNumber";  // see note
		      fw.write(vbs);
		      fw.close();
		      Process p = Runtime.getRuntime().exec("cscript //NoLogo " + file.getPath());
		      BufferedReader input =
		        new BufferedReader
		          (new InputStreamReader(p.getInputStream()));
		      String line;
		      while ((line = input.readLine()) != null) {
		         result += line;
		      }
		      input.close();
		      
		       result=result.trim();
		       
		       if (result.substring(0).length()>5 ) 
		       {
		    	    return result.substring(0);
		       }else if (result.substring(1).length()>5) 
		       {
		    	   return result.substring(1);
		       }else
		       {
		    	   return null;
		       }
		       
		      
		      
		    }
		    catch(Exception e){
		        e.printStackTrace();
		        return null;
		    }
		   
		 
		  
		  }
	
	
	
	
	
	static String removeDupsSorted(String str) 
    { 
        int res_ind = 1, ip_ind = 1; 
          
        // Character array for removal of duplicate characters 
        char arr[] = str.toCharArray(); 
          
        /* In place removal of duplicate characters*/
        while (ip_ind != arr.length) 
        { 
            if(arr[ip_ind] != arr[ip_ind-1]) 
            { 
                arr[res_ind] = arr[ip_ind]; 
                res_ind++; 
            } 
            ip_ind++; 
            
        } 
      
        str = new String(arr); 
        return str.substring(0,res_ind); 
    } 
       
    /* Method removes duplicate characters from the string 
       This function work in-place and fills null characters 
       in the extra space left */
    static String removeDups(String str) 
    { 
       // Sort the character array 
       char temp[] = str.toCharArray(); 
       Arrays.sort(temp); 
       str = new String(temp); 
         
       // Remove duplicates from sorted 
       return removeDupsSorted(str).trim(); 
    } 
	
    /**
	 * If there is no result, it return Null
	 * Get HardDisk Serialnumber
	 */
	public static String Get_HddID2() throws InterruptedException, IOException {
	   
		try {
		String sc = "cmd /c" + "wmic diskdrive get serialnumber";
   
	    Process p = Runtime.getRuntime().exec(sc);
	    p.waitFor();

	    BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));

	    String line;
	    StringBuilder sb = new StringBuilder();

	    while ((line = reader.readLine()) != null) {
	        sb.append(line);
	      //  System.out.print(line);
	    } 
	    
	    String str = sb.substring(sb.toString().lastIndexOf("r") + 1).trim();
	    str = str.replace("_", "");
	    str = str.substring(0, 16) ;
	  //  System.out.print(str);
	  //  System.out.print(removeDups(str));
	  //  System.out.print(str.substring(0, 16));
		
	    if (str.length()>10) {
	    	
			
	       return str.trim();
	    	
	    }
	    else {
	    	
	    	 return null;
	    }
		
		
	   
	 }
	 catch(Exception e){
	        e.printStackTrace();
	        return null;
	    }
		
		
	}
	
////////////////////////////////////////////////////////////////////

	 private static final String[] tensNames = {
			    "",
			    " ten",
			    " twenty",
			    " thirty",
			    " forty",
			    " fifty",
			    " sixty",
			    " seventy",
			    " eighty",
			    " ninety"
			  };

			  private static final String[] numNames = {
			    "",
			    " one",
			    " two",
			    " three",
			    " four",
			    " five",
			    " six",
			    " seven",
			    " eight",
			    " nine",
			    " ten",
			    " eleven",
			    " twelve",
			    " thirteen",
			    " fourteen",
			    " fifteen",
			    " sixteen",
			    " seventeen",
			    " eighteen",
			    " nineteen"
			  };

		
			  private static String convertLessThanOneThousand(int number) {
			    String soFar;

			    if (number % 100 < 20){
			      soFar = numNames[number % 100];
			      number /= 100;
			    }
			    else {
			      soFar = numNames[number % 10];
			      number /= 10;

			      soFar = tensNames[number % 10] + soFar;
			      number /= 10;
			    }
			    if (number == 0) return soFar;
			    return numNames[number] + " hundred" + soFar;
			  }


			  public static String NumberToEnglishWord(long number,String Unit) {
			    // 0 to 999 999 999 999
			    if (number == 0) { return "zero"; }

			    String snumber = Long.toString(number);

			    // pad with "0"
			    String mask = "000000000000";
			    DecimalFormat df = new DecimalFormat(mask);
			    snumber = df.format(number);

			    // XXXnnnnnnnnn
			    int billions = Integer.parseInt(snumber.substring(0,3));
			    // nnnXXXnnnnnn
			    int millions  = Integer.parseInt(snumber.substring(3,6));
			    // nnnnnnXXXnnn
			    int hundredThousands = Integer.parseInt(snumber.substring(6,9));
			    // nnnnnnnnnXXX
			    int thousands = Integer.parseInt(snumber.substring(9,12));

			    String tradBillions;
			    switch (billions) {
			    case 0:
			      tradBillions = "";
			      break;
			    case 1 :
			      tradBillions = convertLessThanOneThousand(billions)
			      + " billion ";
			      break;
			    default :
			      tradBillions = convertLessThanOneThousand(billions)
			      + " billion ";
			    }
			    String result =  tradBillions;

			    String tradMillions;
			    switch (millions) {
			    case 0:
			      tradMillions = "";
			      break;
			    case 1 :
			      tradMillions = convertLessThanOneThousand(millions)
			         + " million ";
			      break;
			    default :
			      tradMillions = convertLessThanOneThousand(millions)
			         + " million ";
			    }
			    result =  result + tradMillions;

			    String tradHundredThousands;
			    switch (hundredThousands) {
			    case 0:
			      tradHundredThousands = "";
			      break;
			    case 1 :
			      tradHundredThousands = "one thousand ";
			      break;
			    default :
			      tradHundredThousands = convertLessThanOneThousand(hundredThousands)
			         + " thousand ";
			    }
			    result =  result + tradHundredThousands;

			    String tradThousand;
			    tradThousand = convertLessThanOneThousand(thousands);
			    result =  result + tradThousand;

			    // remove extra spaces!
			    return result.replaceAll("^\\s+", "").replaceAll("\\b\\s{2,}\\b", " ") + Unit;
			  }
//////////////////////////////////////////////////////////////////////////	
			  /**
			   * 
			   *convert Celsius into Fahrenheit
			   */
			  public static double CelsiusToFahrenheit (double Celsius)  
			    { 
				  double Fahrenheit;
				  Fahrenheit =((Celsius*9)/5)+32;  
			      return Fahrenheit;  
			    }  
			  
			  /**
			   * 
			   *convert Fahrenheit into Celsius
			   */
			  public static double FahrenheitToCelsius (double Fahrenheit)  
			    { 
				  double Celsius;
				  Celsius = ((Fahrenheit-32)*5)/9  ;
			      return Celsius;  
			    }  
	////////////////////////////////////////////////////
			  
			  /**
				 * Reading a particular line from a text file
				 * Return Null if it does not exist
				 *Example:<code>
				 *Dim st As String =  pdd.ReadLine(File.DirApp,"1.txt",10) </code>
				 */
				public static String ReadLine(String Dir, String FileName,int LineNum) throws IOException {
					   
					String lineIWant = null;
				
						InputStreamWrapper in = OpenInput(Dir, FileName);
						TextReaderWrapper tr = new TextReaderWrapper();
						tr.Initialize(in.getObject());
						
						for(int i = 0; i < LineNum; ++i)
							  tr.ReadLine();
						
						lineIWant = tr.ReadLine();
						
						return lineIWant;
				
				
				}
			  
				private static final String assetsDir = "AssetsDir";
				private static InputStreamWrapper OpenInput(String Dir, String FileName) throws IOException {

					InputStreamWrapper is = new InputStreamWrapper();
					if (Dir.equals(assetsDir)) {
						InputStream in = (InputStream) File.class.getResourceAsStream("/Files/" + FileName);
						if (in == null)
							throw new FileNotFoundException(FileName);

						is.setObject(in);
					}

					else
					{
						if ("".equals(Dir))
							Dir = null;
						is.setObject(new BufferedInputStream(new FileInputStream(new java.io.File(Dir, FileName)),
								8192));
					}
					return is;
				}
			  
			  
	////////////////////////////////////////////////////	
			
				public static String MyIp() throws IOException
			    {
				
					
					String ip = null;
				
				      try{
				         URL my_url = new URL("http://bot.whatismyipaddress.com");
				         BufferedReader my_br = new BufferedReader(new
				         InputStreamReader(my_url.openStream()));
				         ip = my_br.readLine().trim();
				      }
				      catch (Exception e){
				         ip = "Cannot Execute Properly";
				      }
					
					return ip;
					
			    }
				
				
				////https://ip-api.com/docs
				 /**
				 * Need Internet Connection.
				 * Return Json String
				 * Return Null If No Result
				 */
				public static String IpInfo(String myip) throws IOException
			    {
					String lc = null;
					
					URL link = new URL("http://ip-api.com/json/"+myip);

					BufferedReader in = new BufferedReader(new InputStreamReader(link.openStream()));
					String inputLine;
					
					while ((inputLine = in.readLine()) != null){
						
						lc = inputLine;
					
					}
					
					in.close();
					
					return lc;
					
			    }
				
				
				
	////////////////////////////////////////////////////		  
	  
			
				/**
			     * return result in milliseconds.
			     * 
			     * return -1 if NOT reachable.
			     */
				 public static long PingIp (String ipAddress) {
					   
					 long PingTime = 0 ;
					    try {
					      InetAddress inet = InetAddress.getByName(ipAddress);
					 
					      System.out.println("Sending Ping Request to " + ipAddress);
					 
					      long finish = 0;
					      long start = new GregorianCalendar().getTimeInMillis();
					 
					      if (inet.isReachable(5000)){
					        finish = new GregorianCalendar().getTimeInMillis();
					        PingTime =  (finish - start);
					        return PingTime;
					        
					      } else {
					        System.out.println(ipAddress + " NOT reachable.");
					        PingTime = -1 ;
					      }
					    } catch ( Exception e ) {
					      System.out.println("Exception:" + e.getMessage());
					      return -1;
					    }
						
					    return PingTime;
						
					
				 }
				 
				
				
        ////////////////////////////////////////
				
								
}
