/*
* Jyotiprakash
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Hotsport {
public static void main(String[] args) {
try {
System.out.println("-- Setting up WLAN --");
String netshCommand = "netsh wlan set hostednetwork mode=allow ssid=\"YourSSID\" key=\"YourPassword\" & exit";
String[] elevateCommand = new String[]{"./Release/elevate.exe", "-wait", "-k", "prog", netshCommand};
ProcessBuilder pb1 = new ProcessBuilder(elevateCommand);
Process p1 = pb1.start();
p1.waitFor();
System.out.println("-- Starting WLAN --");
netshCommand = "netsh wlan start hostednetwork & exit";
elevateCommand = new String[]{"./Release/elevate.exe", "-wait", "-k", "prog", netshCommand};
ProcessBuilder pb2 = new ProcessBuilder(elevateCommand);
Process p2 = pb2.start();
p2.waitFor();
System.out.println("-- Setting up IPv4 interface --");
netshCommand = "netsh interface ipv4 set address \"Conexión de red inalámbrica\" static 192.168.0.102 255.255.255.0 192.168.0.254 & exit";
elevateCommand = new String[]{"./Release/elevate.exe", "-wait", "-k", "prog", netshCommand};
ProcessBuilder pb3 = new ProcessBuilder(elevateCommand);
Process p3 = pb3.start();
p3.waitFor();
System.out.println("-- Getting IPv4 interface dump --");
netshCommand = "netsh interface ipv4 dump";
ProcessBuilder pb4 = new ProcessBuilder("cmd.exe", "/c", netshCommand);
Process p4 = pb4.start();
System.out.println("-- Printing IPv4 interface dump --");
BufferedReader bfr = new BufferedReader(new InputStreamReader(p4.getInputStream(),"ISO-8859-1"));
String output;
while((output = bfr.readLine()) != null){
System.out.println(output);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Wednesday, 2 November 2016
Create a Hotsport in java(Useing OS primitives) !!!!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment