Menu

[r11]: / trunk / SWFInvestigator / src / utils / AMFIdentifier.mxml  Maximize  Restore  History

Download this file

269 lines (232 with data), 9.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?xml version="1.0" encoding="utf-8"?>
<s:Window xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="408" height="565" title="AMF Identifier" close="closePopUp()" backgroundColor="#60f3ea" initialize="initAction()">
<fx:Script>
<![CDATA[
/****************************************************************************
* ADOBE SYSTEMS INCORPORATED
* Copyright 2012 Adobe Systems Incorporated and it’s licensors
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file
* in accordance with the terms of the license agreement accompanying it.
* ****************************************************************************/
import flash.net.registerClassAlias;
import mx.rpc.AbstractOperation;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.mxml.RemoteObject;
import osUtils.FileActionEvent;
import osUtils.FileActions;
import databaseUtils.PreferencesDB;
/**
* @public
* A pointer to the preferences database
*/
public var prefDB:PreferencesDB;
/**
* @private
* A pointer to a FileActionsReference
*/
private var fAction:FileActions;
/**
* @private
* The dictionary Array
*/
private var dict:Array;
/**
* @private
* The position within the dictionary
*/
private var pos:uint;
/**
* @private
* The timer driving the identification process
*/
private var roTimer:Timer;
/**
* @private
* Assigns the text box to the File Location of the dictionary file
*
* @param evt The FileActionEvent
*/
private function grabFileLocation(evt:FileActionEvent):void {
this.dictFilePath.text = evt.target.currentFile.url;
}
/**
* @private
* Initialize's fAction for first use
*/
private function initAction():void {
if (this.fAction != null) {
return;
}
this.fAction = new FileActions();
var dictLoc:String = this.prefDB.getPref("amfDictionary");
if (dictLoc == "") {
dictLoc = "app:/configs/AMFDictionary.txt";
}
this.fAction.currentFile = new File(dictLoc);
if (this.fAction.currentFile == null) {
//The end-user probably changed their config
//This is just a convience task so it is their loss
return;
}
this.fAction.addEventListener(FileActionEvent.OPEN_RO_COMPLETE,grabFileLocation);
this.fAction.openStream(FileActions.READ);
}
/**
* @private
* This function creates the popUp window to select the dictionary file
*/
private function onBrowseClick():void {
if (this.fAction == null) {
this.fAction = new FileActions();
this.fAction.currentFile = File.applicationDirectory.resolvePath("configs");
}
var fFilter:FileFilter = new FileFilter("Text file","*.txt;*.dict");
this.fAction.addEventListener(FileActionEvent.OPEN_RO_COMPLETE,grabFileLocation);
this.fAction.openFile(fFilter,FileActions.READ);
}
/**
* @private
* This function parses the response from the AMF call and displays it in the text field.
* e.currentTarget.destination "restaurant"
* e.currentTarget.operations.[MethodName]
* @param e The ResultEvent from the AMF call.
*/
private function parseResponse(e:ResultEvent):void {
var result:String = "FOUND! The destination '" + e.currentTarget.destination + "' succeeded with '";
for (var j:* in e.currentTarget.operations) {
result += j + "'\n";
}
this.amfOutput.text = result + this.amfOutput.text;
}
/**
* @private
* This function is called when the AMF call issues a FaultEvent.
*
* @param e The FaultEvent from the AMF call
* faultCode: Client.Error.MessageSend rootCause:Channel.Connect.Failed
* e.fault.faultCode"Server.Processing" e.fault.faultString "No destination with id 'r'
* e.fault.faultCode"Server.ResourceUnavailable" e.fault.faultString "Cannot invoke method 'g' e.faultDetail "Methods 'a' not found
* e.faultDetail "0 arguments were sent but 1 were expected"
*/
private function showFault(e:FaultEvent):void {
if (e.fault.faultCode == "Client.Error.MessageSend") {
this.amfOutput.text += "Could not connect to server\n";
} else if (e.fault.faultCode == "Server.Processing") {
this.amfOutput.text += e.fault.faultString + "\n";
} else if (e.fault.faultCode == "Server.ResourceUnavailable") {
if (e.fault.faultDetail.indexOf("Method") == 0) {
if (this.rDest.selected) {
this.amfOutput.text = "FOUND destination '" + e.currentTarget.destination + "'!\n" + this.amfOutput.text;
} else {
this.amfOutput.text += e.fault.faultDetail + "\n";
}
} else if (e.fault.faultDetail.indexOf("0") == 0) {
var results:Array = e.fault.faultString.split("'");
this.amfOutput.text = "FOUND '" + results[1] + "'! - " + e.fault.faultDetail + "\n" + this.amfOutput.text;
}
}
return;
}
/**
* @private
* This function creates a remoteObject and does this send
*
* @param evt The timer event
*/
private function createRO (evt:TimerEvent):void {
var destName:String;
var fName:String;
if (this.rMethod.selected) {
destName = this.roDestination.text;
fName = this.dict[this.pos];
} else {
destName = this.dict[this.pos];
fName = "getName";
}
pos--;
var ro:RemoteObject = new RemoteObject(destName);
ro.endpoint = this.roEndpoint.text;
var returnedData:Object;
ro.addEventListener(ResultEvent.RESULT,parseResponse);
ro.addEventListener(FaultEvent.FAULT,showFault);
if (this.roUsername && this.roUsername.text.length > 0) {
if (this.remoteCreds.selected) {
ro.setRemoteCredentials(this.roUsername.text,this.roPassword.text);
} else {
ro.setCredentials(this.roUsername.text, this.roPassword.text);
}
}
var roOp:AbstractOperation = ro.getOperation(fName);
roOp.send();
}
/**
* @private
* This function will send the AMF request to the remote server based on the entered information.
*/
private function sendRequest():void {
this.amfOutput.text = "";
if (this.dictFilePath.text == "") {
this.amfOutput.text = "PLEASE SELECT A DICTIONARY";
return;
} else if (this.fAction.fileState == "OPEN") {
this.dict = this.fAction.readAsDictionary();
this.fAction.closeFile();
}
this.pos = this.dict.length - 1;
if (this.roTimer == null) {
this.roTimer = new Timer(this.timerValue.value,dict.length);
this.roTimer.addEventListener(TimerEvent.TIMER,createRO);
this.roTimer.addEventListener(TimerEvent.TIMER_COMPLETE,stopAndReset);
} else {
this.roTimer.delay = this.timerValue.value;
this.roTimer.repeatCount = dict.length;
}
this.roTimer.start();
}
/**
* @private
* This function stops and resets the timer
*/
private function stopAndReset(evt:TimerEvent = null):void {
roTimer.reset();
}
/**
* @private
* On Window Close, ensure ObjectCollection PopUp is shut down.
*/
private function closePopUp():void {
// this.sendDG.closePopUp();
}
]]>
</fx:Script>
<s:Label x="10" y="15" width="101" text="RO Endpoint:"/>
<s:TextInput x="119" y="10" width="269" id="roEndpoint" maxChars="4096"
toolTip="Example: http://www.example.com:8400/blazeds/messagebroker/amf"/>
<s:Label x="10" y="41" text="RO Destination:" width="101"/>
<s:TextInput x="119" y="36" width="269" id="roDestination" enabled="false"
toolTip="Example: This would be the id in the destination tag of your remoting-config.xml or proxy-config.xml"/>
<s:Label x="10" y="70" text="Brute Force"/>
<s:RadioButton x="119" y="65.5" id="rDest" label="Destination" selected="true" groupName="BruteForceSelection" click="this.roDestination.enabled=false;"/>
<s:RadioButton x="215" y="65" id="rMethod" label="Method" groupName="BruteForceSelection" click="this.roDestination.enabled=true;"/>
<s:Label x="12" y="114" text="Auth Username:" width="101"/>
<s:TextInput x="10" y="130" width="147" id="roUsername"/>
<s:Label x="216" y="116" text="Auth Password:" width="101"/>
<s:TextInput x="213" y="130" width="147" id="roPassword"/>
<s:CheckBox x="10" y="165" label="Remote Credentials" width="147" id="remoteCreds"/>
<s:Label x="12" y="207.5" text="Dictionary File:"/>
<s:TextInput id="dictFilePath" x="10" y="222" width="304" height="22" editable="false"/>
<s:Button x="323" y="222" label="Browse" click="onBrowseClick()"/>
<s:Label x="10" y="276" text="Query interval (milliseconds):" width="165" height="19"/>
<s:NumericStepper x="213" y="270" value="330" width="74.5" height="22" id="timerValue" minimum="0" stepSize="10" enabled="true" maximum="5000"/>
<s:Button x="9" y="317" label="Start Queries" width="106.5" click="sendRequest()" height="22"/>
<s:Button x="129.5" y="317" label="Reset" click="stopAndReset()"/>
<s:Label x="10" y="362" text="Output" width="124"/>
<s:TextArea x="10" y="378" width="378" height="132" id="amfOutput"/>
<s:Label x="10" y="528" text="status" width="368" id="statusOutput"/>
</s:Window>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.