Aklımda Kalası Kelimeler

* давайте работать вместе
* Zarf ve Mazruf, Zerafet(xHoyratlık) ile aynı kökten(za-ra-fe) gelir
* Bedesten
* Suç subuta ermiştir - Suç sabit olmuştur

30 Temmuz 2013 Salı

IP ve Teamviewer ID çeken Java Applet

Aşağıdaki kodu Java project olarak derleyin ve jar a çevirerek sertifikalayın. Sunucuya yükleyin çalışsın.
import java.applet.Applet;
import java.awt.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Enumeration;

public class FirstApplet extends Applet
{
 public String lineSeparator = "";

 public void init()
 {
  lineSeparator = ff();
 }

 public void paint(Graphics g)
 {
  // Set the color to blue
  g.setColor(Color.blue);

  // Write the message to the web page
  int y = 10;
  for (String line : lineSeparator.split("\n")){
   g.drawString(line, 10, y += 15);
  }
 }

 public String ff()
 {
  String a = "";
  try
  {
   String query = "reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\TeamViewer\\Version7\" /v ClientID";
   ArrayList<string> output = new ArrayList<string>();
   Process p = Runtime.getRuntime().exec(query);
   BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()), 8 * 1024);
   String s = null;
   while ((s = stdInput.readLine()) != null)
   {
    output.add(s);
   }

   String val = (output.get(2));
   String version = val.trim().split("   ")[2].trim();
   int iTeamviewerID = Integer.parseInt(version.substring(2), 16);
   a += "Teamviewer ID: " + iTeamviewerID;
  }
  catch (Exception e)
  {
   return null;
  }

  try
  {
   a += "\nAğ Adresleri:";
   Integer i = 0, j = 0;
   for (Enumeration<networkinterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();)
   {
    i++;
    NetworkInterface intf = en.nextElement();
    if (intf.isUp() && !intf.isLoopback() && !intf.isVirtual())
    {
     a += "\n   Görünen Ad: " + intf.getDisplayName();
     for (Enumeration<inetaddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();)
     {
      j++;
      String ip = enumIpAddr.nextElement().toString();
      if(ip.contains(".")){
       a += "\n        IP Adresi: " + ip.replace('/', ' ');
      }
     }
    }
   }
  }
  catch (SocketException e)
  {
  }
  return a;
 }
}

Hiç yorum yok: