MCPcopy Index your code
hub / github.com/cSploit/android / run

Method run

cSploit/src/org/csploit/android/plugins/PacketForger.java:108–217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

106
107 mThread = new Thread(new Runnable() {
108 @Override
109 public void run() {
110 int protocol = mProtocol.getSelectedItemPosition(), port = -1;
111 String data = mData.getText() + "", error = null;
112 boolean waitResponse = mWaitResponse.isChecked();
113
114 try {
115 port = Integer.parseInt(mPort.getText() + "".trim());
116 if (port <= 0 || port > 65535)
117 port = -1;
118 } catch (Exception e) {
119 port = -1;
120 }
121
122 if (port == -1)
123 error = getString(R.string.invalid_port);
124
125 else if (data.isEmpty())
126 error = getString(R.string.request_empty);
127
128 else {
129 try {
130 if (protocol == TCP_PROTOCOL) {
131 mSocket = new Socket(System
132 .getCurrentTarget()
133 .getCommandLineRepresentation(),
134 port);
135 OutputStream writer = mSocket
136 .getOutputStream();
137
138 writer.write(data.getBytes());
139 writer.flush();
140
141 if (waitResponse) {
142 BufferedReader reader = new BufferedReader(
143 new InputStreamReader(mSocket
144 .getInputStream()));
145 String response = "", line = null;
146
147 while ((line = reader.readLine()) != null) {
148 response += line + "\n";
149 }
150
151 final String text = response;
152 PacketForger.this
153 .runOnUiThread(new Runnable() {
154 public void run() {
155 mResponse.setText(text);
156 }
157 });
158
159 reader.close();
160 }
161
162 writer.close();
163 mSocket.close();
164 } else if (protocol == UDP_PROTOCOL) {
165 mUdpSocket = new DatagramSocket();

Callers

nothing calls this directly

Calls 7

getCurrentTargetMethod · 0.95
setStoppedStateMethod · 0.95
getTextMethod · 0.80
isEmptyMethod · 0.80
getAddressMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected