OpenSecurity/vm/usr/local/bin/ff
author om
Mon, 02 Dec 2013 16:02:00 +0100
changeset 5 166c38b8b6ed
child 6 088f4b20dbbc
permissions -rwxr-xr-x
added multiple session firefox script
om@5
     1
#!/bin/bash
om@5
     2
om@5
     3
# create a disposable firefox session
om@5
     4
#
om@5
     5
# Remark:   this script expects the firefox sessions
om@5
     6
#           to be stored in ~/.mozilla/fireofx
om@5
     7
#
om@5
     8
om@5
     9
# pick the next profile number
om@5
    10
PROFILE_NUMBER=$(new_firefox_profile_id.py)
om@5
    11
PROFILE_PATH=$(basename $(mktemp -d ~/.mozilla/firefox/XXXXXXXX.os_user_${PROFILE_NUMBER}))
om@5
    12
PROFILE_TIMESTAMP="$(date +%s)000"
om@5
    13
PROFILE_NAME=$(echo ${PROFILE_PATH} | awk -F '.' '{ print $NF; }')
om@5
    14
om@5
    15
# create a fake times.json
om@5
    16
cat > ${PROFILE_PATH}/times.json << __EO_TIMES_JSON__
om@5
    17
{
om@5
    18
"created": ${PROFILE_TIMESTAMP}
om@5
    19
}
om@5
    20
__EO_TIMES_JSON__
om@5
    21
om@5
    22
# add out new "profile" to firefox
om@5
    23
cat >> ~/.mozilla/firefox/profiles.ini << __EO_PROFILES_INI__
om@5
    24
[Profile${PROFILE_NUMBER}]
om@5
    25
Name=${PROFILE_NAME}
om@5
    26
IsRelative=1
om@5
    27
Path=${PROFILE_PATH}
om@5
    28
om@5
    29
__EO_PROFILES_INI__
om@5
    30
om@5
    31
om@5
    32
# launch firefox
om@5
    33
firefox -P ${PROFILE_NAME} -no-remote $@