How to use port_open method of end.end.end Package

Best Unobtainium_ruby code snippet using end.end.end.port_open

DecryptionData.java

Source:DecryptionData.java Github

copy

Full Screen

...6import com.tranquyet.chat.object.User;7public class DecryptionData {8 private static Pattern createUser = Pattern9 .compile(Dictionary.session_open + Dictionary.user_name + ".*" + Dictionary.user_name_close10 + Dictionary.port_open + ".*" + Dictionary.port_close + Dictionary.session_close);;11 private static Pattern users = Pattern.compile(Dictionary.session_accept_open + " " + Dictionary.user_open12 + Dictionary.user_name + ".+" + Dictionary.user_name_close + Dictionary.ip_open + ".+" + Dictionary.ip_close13 + Dictionary.port_open + "[0-9]+" + Dictionary.port_close + Dictionary.user_close + ")*"14 + Dictionary.session_accept_close);15 private static Pattern request = Pattern.compile(Dictionary.session_live + Dictionary.user_name + "[^<>]+"16 + Dictionary.user_name_close + Dictionary.status_open + " " + Dictionary.serverOn + Dictionary.serverOff17 + " " + Dictionary.status_close + Dictionary.session_die);18 private static Pattern message = Pattern19 .compile(Dictionary.chat_message_open + ".*" + Dictionary.chat_message_close);20 private static Pattern checkFile = Pattern.compile(Dictionary.file_open + ".*" + Dictionary.file_close);21 private static Pattern comment = Pattern.compile(Dictionary.file_ack_open + ".*" + Dictionary.file_ack_close);22 public static List<String> getUser(String message) {23 List<String> user = new ArrayList<String>();24 if (createUser.matcher(message).matches()) {25 Pattern findUser = Pattern.compile(Dictionary.user_name + ".*" + Dictionary.user_name_close);26 Pattern findPort = Pattern.compile(Dictionary.port_open + " [0-9]* " + Dictionary.port_close);27 Matcher find = findUser.matcher(message);28 if (find.find()) {29 String name = find.group(0);30 user.add(name.substring(11, name.length() - 11));31 find = findPort.matcher(message);32 if (find.find()) {33 String port = find.group(0);34 user.add(port.substring(6, port.length() - 7));35 } else {36 return null;37 }38 } else {39 return null;40 }41 } else {42 return null;43 }44 return user;45 }46 public static List<User> getAllUser(String message) {47 List<User> user = new ArrayList<User>();48 Pattern findUser = Pattern.compile(Dictionary.user_open + Dictionary.user_name + " [^<>]* "49 + Dictionary.user_name_close + Dictionary.ip_open + " [^<>]* " + Dictionary.ip_close50 + Dictionary.port_open + " [0-9]* " + Dictionary.port_close + Dictionary.user_close);51 Pattern findName = Pattern.compile(Dictionary.user_name + ".*" + Dictionary.user_name_close);52 Pattern findPort = Pattern.compile(Dictionary.port_open + "[0-9]*" + Dictionary.port_close);53 Pattern findIp = Pattern.compile(Dictionary.ip_open + ".*" + Dictionary.ip_close);54 if (users.matcher(message).matches()) {55 Matcher find = findUser.matcher(message);56 while (find.find()) {57 String person = find.group(0);58 String data;59 User userTemp = new User();60 Matcher findInfo = findName.matcher(person);61 if (findInfo.find()) {62 data = findInfo.group(0);63 userTemp.setNameUser(data.substring(11, data.length() - 11));64 }65 findInfo = findIp.matcher(person);66 if (findInfo.find()) {...

Full Screen

Full Screen

Decryption.java

Source:Decryption.java Github

copy

Full Screen

1package com.tranquyet.dictionary;2import java.util.ArrayList;3import java.util.regex.Matcher;4import java.util.regex.Pattern;5import com.tranquyet.data.User;6public class Decryption {7 private static Pattern createAccount = Pattern8 .compile(Dictionary.SESSION_OPEN + Dictionary.PEER_NAME_OPEN + ".*" + Dictionary.PEER_NAME_CLOSE9 + Dictionary.PORT_OPEN + ".*" + Dictionary.PORT_CLOSE + Dictionary.SESSION_CLOSE);10 private static Pattern users = Pattern.compile(Dictionary.SESSION_ACCEPT_OPEN + "(" + Dictionary.PEER_OPEN11 + Dictionary.PEER_NAME_OPEN + ".+" + Dictionary.PEER_NAME_CLOSE + Dictionary.IP_OPEN + ".+"12 + Dictionary.IP_CLOSE + Dictionary.PORT_OPEN + "[0-9]+" + Dictionary.PORT_CLOSE + Dictionary.PEER_CLOSE13 + ")*" + Dictionary.SESSION_ACCEPT_CLOSE);14 private static Pattern request = Pattern.compile(Dictionary.SESSION_KEEP_ALIVE_OPEN + Dictionary.PEER_NAME_OPEN15 + "[^<>]+" + Dictionary.PEER_NAME_CLOSE + Dictionary.STATUS_OPEN + "(" + Dictionary.SERVER_ONLINE + "|"16 + Dictionary.SERVER_OFFLINE + ")" + Dictionary.STATUS_CLOSE + Dictionary.SESSION_KEEP_ALIVE_CLOSE);17 private static Pattern message = Pattern.compile(Dictionary.CHAT_MSG_OPEN + ".*" + Dictionary.CHAT_MSG_CLOSE);18 private static Pattern checkNameFile = Pattern.compile(Dictionary.FILE_REQ_OPEN + ".*" + Dictionary.FILE_REQ_CLOSE);19 private static Pattern feedBack = Pattern20 .compile(Dictionary.FILE_REQ_ACK_OPEN + ".*" + Dictionary.FILE_REQ_ACK_CLOSE);21 public static boolean checkFile(String name) {22 if (checkNameFile.matcher(name).matches())23 return true;24 return false;25 }26 public static boolean checkFeedBack(String msg) {27 if (feedBack.matcher(msg).matches())28 return true;29 return false;30 }31 public static ArrayList<String> getUser(String msg) {32 ArrayList<String> user = new ArrayList<String>();33 if (createAccount.matcher(msg).matches()) {34 Pattern findName = Pattern.compile(Dictionary.PEER_NAME_OPEN + ".*" + Dictionary.PEER_NAME_CLOSE);35 Pattern findPort = Pattern.compile(Dictionary.PORT_OPEN + "[0-9]*" + Dictionary.PORT_CLOSE);36 Matcher find = findName.matcher(msg);37 if (find.find()) {38 String name = find.group(0);39 user.add(name.substring(11, name.length() - 12));40 find = findPort.matcher(msg);41 if (find.find()) {42 String port = find.group(0);43 user.add(port.substring(6, port.length() - 7));44 } else45 return null;46 } else47 return null;48 } else49 return null;50 return user;51 }52 public static ArrayList<User> getAllUser(String msg) {53 ArrayList<User> user = new ArrayList<User>();54 Pattern findPeer = Pattern.compile(Dictionary.PEER_OPEN + Dictionary.PEER_NAME_OPEN + "[^<>]*"55 + Dictionary.PEER_NAME_CLOSE + Dictionary.IP_OPEN + "[^<>]*" + Dictionary.IP_CLOSE56 + Dictionary.PORT_OPEN + "[0-9]*" + Dictionary.PORT_CLOSE + Dictionary.PEER_CLOSE);57 Pattern findName = Pattern.compile(Dictionary.PEER_NAME_OPEN + ".*" + Dictionary.PEER_NAME_CLOSE);58 Pattern findPort = Pattern.compile(Dictionary.PORT_OPEN + "[0-9]*" + Dictionary.PORT_CLOSE);59 Pattern findIP = Pattern.compile(Dictionary.IP_OPEN + ".+" + Dictionary.IP_CLOSE);60 if (users.matcher(msg).matches()) {61 Matcher find = findPeer.matcher(msg);62 while (find.find()) {63 String peer = find.group(0);64 String data = "";65 User dataPeer = new User();66 Matcher findInfo = findName.matcher(peer);67 if (findInfo.find()) {68 data = findInfo.group(0);69 dataPeer.setName(data.substring(11, data.length() - 12));70 }71 findInfo = findIP.matcher(peer);72 if (findInfo.find()) {73 data = findInfo.group(0);74 dataPeer.setHost(findInfo.group(0).substring(5, data.length() - 5));75 }76 findInfo = findPort.matcher(peer);77 if (findInfo.find()) {78 data = findInfo.group(0);79 dataPeer.setPort(Integer.parseInt(data.substring(6, data.length() - 7)));80 }81 user.add(dataPeer);82 }83 } else84 return null;85 return user;86 }87 public static ArrayList<User> updatePeerOnline(ArrayList<User> peerList, String msg) {88 Pattern alive = Pattern.compile(Dictionary.STATUS_OPEN + Dictionary.SERVER_ONLINE + Dictionary.STATUS_CLOSE);89 Pattern killUser = Pattern.compile(Dictionary.PEER_NAME_OPEN + "[^<>]*" + Dictionary.PEER_NAME_CLOSE);90 if (request.matcher(msg).matches()) {91 Matcher findState = alive.matcher(msg);92 if (findState.find())93 return peerList;94 findState = killUser.matcher(msg);95 if (findState.find()) {96 String findPeer = findState.group(0);97 int size = peerList.size();98 String name = findPeer.substring(11, findPeer.length() - 12);99 for (int i = 0; i < size; i++)100 if (name.equals(peerList.get(i).getName())) {101 peerList.remove(i);102 break;103 }104 }105 }106 return peerList;107 }108 public static String getMessage(String msg) {109 if (message.matcher(msg).matches()) {110 int begin = Dictionary.CHAT_MSG_OPEN.length();111 int end = msg.length() - Dictionary.CHAT_MSG_CLOSE.length();112 System.out.println(begin + " " + end);113 String message = msg.substring(begin, end);114 return message;115 }116 return null;117 }118 public static String getNameRequestChat(String msg) {119 Pattern checkRequest = Pattern.compile(Dictionary.CHAT_REQ_OPEN + Dictionary.PEER_NAME_OPEN + "[^<>]*"120 + Dictionary.PEER_NAME_CLOSE + Dictionary.CHAT_REQ_CLOSE);121 if (checkRequest.matcher(msg).matches()) {122 int lenght = msg.length();123 String name = msg.substring((Dictionary.CHAT_REQ_OPEN + Dictionary.PEER_NAME_OPEN).length(),124 lenght - (Dictionary.PEER_NAME_CLOSE + Dictionary.CHAT_REQ_CLOSE).length());125 return name;126 }127 return null;128 }129}...

Full Screen

Full Screen

PortConnect.java

Source:PortConnect.java Github

copy

Full Screen

1package mqeye.service.tools;2import java.io.IOException;3import java.net.InetSocketAddress;4import java.net.Socket;5import java.net.SocketAddress;6import java.net.SocketTimeoutException;7import org.apache.commons.lang.StringUtils;8import mqeye.service.Constant;9import mqeye.service.detect.PortResult;10class Conn implements Runnable11{12 String ip;13 String port ;14 public Conn(String ip , String port){15 this.ip = ip; this.port = port;16 }17 @Override18 public void run() {19 // TODO Auto-generated method stub20 PortConnect conn = new PortConnect();21 PortResult r = conn.connect( ip , port );22 if (StringUtils.equals(r.getStatus(), PortConnect.PORT_OPEN)){23 System.out.println("--------------" + port + " is openned.");24 }25 }26}27public class PortConnect {28 29 /*PORT RESULT*/30 public static final String PORT_CLOSED = "closed";31 public static final String PORT_OPEN = "openning";32 public static final int PORT_TIMEOUT = 5000;33 34 public static void main(String[] args){35 String ip = "219.231.0.139";36 int start_port = 10;37 int end_port = 100000;38 39 for(int port = start_port ; port <=end_port ; port++)40 {41 Conn c = new Conn(ip,port+"");42 new Thread(c).start();43 44 }45 }46 public PortResult connect(String ip , String port ){47 PortResult pr = new PortResult();48 pr.setPort(port);49 long pre=System.currentTimeMillis();50 Socket s = null ;51 try {52 s = new Socket();53 SocketAddress add = new InetSocketAddress(ip,Integer.parseInt(port));54 s.connect(add,PortConnect.PORT_TIMEOUT);55 56 pr.setStatus(PortConnect.PORT_OPEN);57 } catch (SocketTimeoutException e) {58 DebugTool.printErr("Socket Time out EXCEPTION!");59 pr.setStatus(PortConnect.PORT_CLOSED);60 } catch (IOException e) {61 // TODO Auto-generated catch block62 DebugTool.printErr("IO port closed EXCEPTION!");63 pr.setStatus(PortConnect.PORT_CLOSED);64 }65 finally { 66 try {67 if (s != null) s.close();68 } catch (IOException e) {69 DebugTool.printErr("PORT SOCKET EXCEPTION!");70 DebugTool.printExc(e);71 pr.setStatus(PortConnect.PORT_CLOSED);72 } 73 }74 long post =System.currentTimeMillis();75 long timeConsum = post-pre;76 timeConsum = ( timeConsum < PortConnect.PORT_TIMEOUT? timeConsum : PortConnect.PORT_TIMEOUT);77 pr.setTimeConsum(timeConsum);78 return pr ;79 } 80}...

Full Screen

Full Screen

port_open

Using AI Code Generation

copy

Full Screen

1if port_open?(port, host)2 def port_open?(port, host)3 Timeout::timeout(1) do4 s = TCPSocket.new(host, port)5port_open?(port, host)6port_open(port, host)7End::End::End.port_open(port, host)8End::End::End.port_open?(port, host)9End::End.port_open(port, host)10End::End.port_open?(port, host)11End.port_open(port, host)12End.port_open?(port, host)13End.port_open(port, host)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Unobtainium_ruby automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful