Fetching URL link from external swf file in Action script 3 - flash-cs6

i just want to ask if it's possible get the URL link from an external shock wave flash file through loader and add child function.
Basically the shock wave flash file is just an image that you can click and will send you to a link similar to the href in html. I need to fetch the URL to be able top load it in the stage Web View function.

You can access the URL, but only if the URL is stored in a public variable on the swf you are loading.
You can use loaderinfo to get what you are looking for. You can even call public functions of the loaded swf as well. See this code example:
// load external swf
var loader:Loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoadComplete);
loader.load(new URLRequest('your_external_swf.swf'));
private function swfLoadComplete(e:Event):void
{
// create LoaderInfo instance for loaded swf
var loaderInfo:LoaderInfo = e.target as LoaderInfo;
// add swf to stage, or a parent movieclip... whatever
addChild(e.target.content);
// cast an object to the content property of loaderInfo
var swf:Object = loaderInfo.content;
// access a variable in your loaded swf
trace(swf.yourVariable) ;
// call a function in your loaded swf
swf.yourFunctionName();
}

Related

Intercept and edit multipart form-data POST request body in Browser

I've got a site that accepts file uploads which are sent as multipart/form-data within a POST request. To verify that the upload, which shows the filename afterwards, is secured against XSS I want to upload a file which contains HTML Tags in the filename.
This is actually harder than I expected. I can't create a file containing < on my filesystem (Windows). Also, I don't know a way to change the filename of the file input element inside the DOM before the upload (which is what I would do with normal/hidden inputs). So I thought about editing the POST body before it's uploaded, but I don't know how. Popular extensions (I recall Tamper Data, Tamper Dev) only let me change headers. I guess this is due to the plugin system of Chrome, which is the Browser I use.
So, what's the simplest way of manipulating the POST requests body? I could craft the entire request using cUrl, but I also need state, lots of additional parameters and session data etc. which gets quite complex... A simple way within the Browser would ne nice.
So, while this is not a perfect solution, it is at least a way to recreate and manipulate the form submit using FormData and fetch. It is not as generic as I'd like it to be, but it works in that case. Just use this code in the devtools to submit the form with the altered filename:
let formElement = document.querySelector('#idForm'); // get the form element
let oldForm = new FormData(formElement);
let newForm = new FormData;
// copy the FormData entry by entry
for (var pair of oldForm.entries()) {
console.log(pair[0]+': '+pair[1]);
if(typeof(pair[1]) == 'object' && pair[1].name) {
// alter the filename if it's a file
newForm.append(pair[0],pair[1],'yourNewFilename.txt');
} else {
newForm.append(pair[0],pair[1]);
}
}
// Log the new FormData
for (var pair of newForm.entries()) {
console.log(pair[0]+': ');
console.log(pair[1]);
}
// Submit it
fetch(formElement.action, {
method: formElement.method,
body: newForm
});
I'd still appreciate other approaches.

Filepicker.io Javascript API Remove

Trying to use the remove function after the pick function and file is not being removed. (from here https://www.filepicker.com/documentation/file_ingestion/javascript_api/remove?v=v2)
selectFileMedium: function () {
filepicker.pick({
cropRatio: 24/13,
mimetype: 'image/*',
imageDim: [1440, 780]
}, function (Blob) {
InnerThis.uploadMediumImage(Blob.url, Blob.filename);
filepicker.remove(Blob);
});
}
Am I doing this correct?
Blob object return url property which is unificated url of uploaded file eg:
https://www.filepicker.io/api/file/AQgF2U68SNmJDpDXlOdg
However since v2 dialog version there is crop UI avaliable. If user crop file as a response it return the uploaded file url with appended Rest convert parameters:
https://www.filepicker.io/api/file/AQgF2U68SNmJDpDXlOdg/convert?crop=100,200,200,300
filepicker.remove dose not deal with it. Some temporary workaround would be to strip url from '/convert' part just before remove it. However it should be solved on library side.

Fiddler Script - SaveResponseBody()

I want to save all png images that are loaded along with some webpage into a separate folder.
I am using below code with in Fiddler Script [CustomRules.js].
static function OnBeforeResponse(oSession: Session)
{
if(oSession.url.EndsWith(".png"))
{
oSession.SaveResponseBody();
}
//Actual content of OnBeforeResponse function.
}
Problem here is, I was unable to find any image got saved within Program files/Documents.
Where do “SaveResponseBody()” will save the HTTP Response Body?
Can we give our own custom folder?
My Fiddler version is (v4.4.5.6)
The default SaveResponseBody() method saves the files to your \Documents\Fiddler2\Captures\ folder. If you want to use a different name, use the overload that accepts a filename. You should check the Response's status code is 200 to ensure that you're not trying to save off HTTP/304 responses which won't contain a body. Also, rather than looking at the URL, you probably want to check the response's type.
So you end up with something like this:
if ((oSession.responseCode == 200) &&
oSession.oResponse.headers.ExistsAndContains("Content-Type", "image/png"))
{
SaveResponseBody("C:\\temp\\" + oSession.SuggestedFilename);
}
Note: The manual way of doing this would be to go to the QuickExec box below the Web Sessions list, type select png and hit Enter, then click File > Export > Selected Sessions > Raw Files.

Mounted mapper with named parameters also receives requests for image

In my application I mount following URL:
this.mountPage("/details/${site}", MerchantDetailPage.class);
So a request to for instance ../details/anything will create an instance of MerchantDetailPage with pageparameter: site=anything.
The constructor of MerchantDetailPage:
public MerchantDetail(final PageParameters parameters) {
super();
org.apache.wicket.util.string.StringValue storeParameter = parameters.get("site");
if (!storeParameter.isEmpty()) {
this.store = this.service.getStoreByQBonSiteWithCategoriesDescriptionsRegionAndAddress(storeParameter.toString());
}
if (store == null) {
throw new RestartResponseAtInterceptPageException(Application.get().getHomePage());
}
// Build the page
this.createPage(this.store, null);
}
This seemed to work fine until I noticed that the constructor was called 4 times.
After some digging I found that the constructor was called once with parameter site=anything but then another 3 times for 3 images that are on the page; e.g.:
<img wicket:id="store_no_image" src="./images/shop_no_logo_big.png" alt="logo" />
So, for this resource Wicket is also calling this page but with parameter: site=images.
As a consequence, the store is null so the request for the image is redirected to the homepage => the image is not found.
Why is this happening? Why is wicket trying to treat a resource request through a page mount?
Some side comments:
MerchantDetailPage has also another constructor which is called directly from the code and accepts the store id as a parameter. In this case the problem does not occur.
if I use an absolute URL for the image it does work (does not enter into MerchantDetailPage for the image request)
Well... your page resides at
/detail/anything
which is correctly mapped to your merchant detail page...
Your images reside at
/detail/images/shop_no_logo_big.png
and similar, which is correctly mapped to your merchant detail page...
The mount path doesn't know and doesn't care if it's a page request or a resource request. For all it is worth it could be the case that you're using the mount path to create the resource dynamically...
So the solution is to move your images to a location that doesn't match yout mount-path.

Manage Titles when Uploading Multiple Images

It would be great if we could manage the titles of each image that we upload when uploading multiple images. This way I could select each image that I want to upload, title them, then hit the upload button. Right now one must either upload one by one or have all the selected images have the same title.
Kinda like Facebook or Panoramio where it's easy to manage the titles of the images before uploading.
This isn't natively supported in Fine Uploader at the moment, but I've opened up a feature request and tentatively scheduled it for the 3.7 milestone. In the meantime, you can certainly provide your own UI elements to allow users to provide alternate names for each upload-able item and pass these new names as a parameter. Server-side, you would have to parse this parameter and associate it with the uploaded item. Fine Uploader will have to adopt a parameter name that contains the user-supplied alternate filename anyway (and the server will have to be aware of this convention and parse this parameter), since we won't be able to change the value file input field sent along with the multipart encoded request.
use this:
var uploader = $('.uploader'),
titleBox = $('input[type=text]');
uploader.fineUploader({
request: {
endpoint: 'path/to/url'
},
formatFileName: function (name) {
var title = titleBox.val() + ' - ' + name + '';
titleBox.val('');
return title;
},
});
uploader.on('submit', function (event, id, name) {
uploader.fineUploader('setParams', {title: titleBox.val()}, id);
});