Menu

[r11]: / trunk / SWFInvestigator / src / tabs / StringViewer.mxml  Maximize  Restore  History

Download this file

169 lines (148 with data), 6.1 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
<?xml version="1.0" encoding="utf-8"?>
<s:NavigatorContent 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="756" height="594" show="initStrings()">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<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.
* ****************************************************************************/
/********************
* Strings Tab *
********************/
import osUtils.FileActionEvent;
import osUtils.FileActions;
private var securityStrings:Array;
private var fActions:FileActions;
/**
* @private
* Initializes the Strings tab upon viewing.
*/
public function initStrings():void {
if (parentApplication.currentASD == null) {
stringsList.dataProvider = null;
return;
}
if (securityStrings == null) {
this.fActions = new FileActions();
var stringsLoc:String = parentApplication.pDB.getPref("securityStrings");
if (stringsLoc == "") {
stringsLoc = "app:/configs/securityStrings.txt";
}
this.fActions.currentFile = new File(stringsLoc);;
this.fActions.openStream(FileActions.READ);
this.securityStrings = this.fActions.readAsDictionary();
this.fActions.closeFile();
}
if (parentApplication.currentASD.swfData.avm2) {
var arr:Array = parentApplication.currentASD.dumpStrings();
numStrings.text = "" + arr.length;
findSecurityStrings(arr);
//Hack to get around a bug in Flex SDK
//FlexSDK would try to interpret toString as toString()
//Changed to work for all strings due to similar bugs
//Manually assign the value to include space
for (var i:int = 0; i < arr.length; i++) {
arr[i] = arr[i] + " ";
}
stringsList.dataProvider = arr;
}
}
/**
* @private
* Provides the search functionality to find a string within the array of strings and highlight it.
*/
private function findString():void {
if (searchText.text == null) {
return;
}
this.searchButton.label="Find Next";
stringsList.findString(searchText.text);
}
/**
* @private
* Search for relevant security strings
*
* @param stringsArr The list of strings for this application
*/
private function findSecurityStrings(stringsArr:Array):void {
var foundSecurityStrings:Array = new Array();
var i:int = 0;
for (i = 0; i < stringsArr.length; i++) {
if (this.securityStrings.indexOf(stringsArr[i]) != -1) {
foundSecurityStrings.push(stringsArr[i]);
}
}
//Hack to get around a bug in Flex SDK
//FlexSDK would try to interpret toString as toString()
//Changed to work for all strings due to similar bugs
//Manually assign the value to include space
for (i = 0; i < foundSecurityStrings.length; i++) {
foundSecurityStrings[i] = foundSecurityStrings[i] + " ";
}
if (foundSecurityStrings.length == 0) {
foundSecurityStrings.push("No relevant strings found");
}
securityStringsList.dataProvider = foundSecurityStrings;
}
/**
* @private
* Assigns the text box to the File Location of the dictionary file
*
* @param evt The FileActionEvent
*/
private function updateSecurityStrings(evt:FileActionEvent):void {
this.securityStrings = evt.target.readAsDictionary();
evt.target.closeFile();
this.findSecurityStrings(parentApplication.currentASD.dumpStrings());
}
/**
* @private
* This function creates the popUp window to select the dictionary file
*/
private function onBrowseClick():void {
if (this.fActions == null) {
this.fActions = new FileActions();
this.fActions.currentFile = File.applicationDirectory.resolvePath("configs");;
}
var fFilter:FileFilter = new FileFilter("Text file","*.txt;*.dict");
this.fActions.addEventListener(FileActionEvent.OPEN_RO_COMPLETE,updateSecurityStrings);
this.fActions.openFile(fFilter,FileActions.READ);
}
]]>
</fx:Script>
<s:Group percentWidth="90" height="580">
<s:VGroup x="10" y="5" paddingLeft="10" paddingTop="10" paddingBottom="10" width="330" height="100%">
<s:HGroup width="299">
<s:Label x="23" y="14" text="Number of Strings: " width="112"/>
<s:Label x="137" y="14" width="78" id="numStrings" enabled="true"/>
</s:HGroup>
<s:Group height="74">
<s:Label x="-1" y="4" width="109" text="Search all strings:"/>
<s:TextInput id="searchText" x="0" y="16" width="300" click="this.searchButton.label='Find'"/>
<s:Button x="227" y="43" id="searchButton" label="Find" click="findString()"/>
</s:Group>
<s:Group width="299" height="409">
<mx:HRule x="3" y="4" width="283" height="1"/>
<s:Label x="3" y="18" width="138" text="Security relevant strings:"/>
<mx:List x="3" y="30" width="283" height="375" id="securityStringsList"/>
</s:Group>
<s:HGroup width="268" height="27" verticalAlign="middle">
<s:Label x="37" y="539" text="Select a different string dictionary:"/>
<s:Button x="236" y="533" label="Choose" click="onBrowseClick()"/>
</s:HGroup>
</s:VGroup>
<s:VGroup x="340" y="5" paddingLeft="10" paddingBottom="10" paddingRight="10" paddingTop="10" percentWidth="100">
<s:Label x="339" y="14" percentWidth="100" text="All strings:"/>
<mx:List x="339" y="32" percentWidth="100" height="527" id="stringsList"/>
</s:VGroup>
</s:Group>
</s:NavigatorContent>
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.