Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration: Add Cyberchef to Chrome settings #725

Open
Ana06 opened this issue Oct 26, 2023 · 2 comments
Open

Configuration: Add Cyberchef to Chrome settings #725

Ana06 opened this issue Oct 26, 2023 · 2 comments
Assignees
Labels
🌀 FLARE-VM A package or feature to be used by FLARE-VM 💎 enhancement It is working, but it could be better

Comments

@Ana06
Copy link
Member

Ana06 commented Oct 26, 2023

Details

Add the following to the cyberchef.vm (needs #296):

  • Add CyberChef to bookmark bar in Chrome
  • Add Cyberchef to chrome://settings/onStartup

Add the following to googlechrome.vm (to be created in #469):

  • Set Chrome to default for .html files
  • Set Chrome as default browser (Default apps)
@Ana06 Ana06 added 💎 enhancement It is working, but it could be better 🌀 FLARE-VM A package or feature to be used by FLARE-VM labels Oct 26, 2023
@Ana06 Ana06 added this to the FLARE-VM 2023 Q4 milestone Oct 26, 2023
@Ana06 Ana06 self-assigned this Oct 26, 2023
@Ana06 Ana06 assigned binjo and unassigned Ana06 Oct 26, 2023
@binjo
Copy link
Contributor

binjo commented Dec 11, 2023

adding CyberChef to bookmark bar is a bit tricky, as when fresh installation, the Google Chrome's bookmarks file and related user default directories are not created yet. The following code snippet works when the bookmarks file exists:

# https://stackoverflow.com/questions/10813221/adding-bookmark-to-web-browser-from-external-applications
function Add-Chrome-Bookmark {
    Param
    (
        [Parameter(Mandatory=$true, Position=0)]
        [string] $bookMarkName,
        [Parameter(Mandatory=$true, Position=1)]
        [string] $bookMarkUrl
    )
    $fileBookmarks="$env:LOCALAPPDATA\Google\Chrome\User Data\Default\Bookmarks"
    $dirBookmarks = Split-Path $fileBookmarks
    # initial installation does not have the directories
    if (Test-Path $dirBookmarks) {
        $dataBookmarks=Get-Content $fileBookmarks -Encoding UTF8| Out-String |ConvertFrom-Json
    } else {
        New-Item -ItemType Directory -Force -Path $dirBookmarks # this does not work
        $dataBookmarks= "{'roots': {'bookmark_bar': {'children': []}}}" | ConvertFrom-Json
    }
    function createNewChromeBookmark ($Bookmarks, [string]$BookmarkName, [string]$BookmarkURL) {
        function getBookmarkIDs($object){
            $object | ForEach-Object{
                "{0:0000}" -f [int]($_.id);
                if([bool]($_.PSobject.Properties.name -match "children")){
                    GetBookmarkIDs($_.children);
                }
            }
        };
        $nextBookmarkID = [int](getBookmarkIDs -object $Bookmarks.roots.bookmark_bar|Sort-Object -Descending|Select-Object -First 1) + 1
        $currentChomeTime=[System.DateTimeOffset]::Now.ToUnixTimeMilliseconds()*10000;
        $newBookmark= [PSCustomObject]@{
            date_added=$currentChomeTime
            guid=[guid]::NewGuid()
            id=$nextBookMarkID
            name="$BookmarkName"
            type="url"
            url="$BookmarkURL"
        }
        return $newBookmark;
    }
    $newBookmark = createNewChromeBookmark -Bookmarks $dataBookmarks -BookmarkName $bookMarkName -BookmarkURL $bookMarkUrl
    $dataBookmarks.roots.bookmark_bar.children += $newBookmark;
    # [+] Error: The maximum depth allowed for serialization is 100.
    $dataBookmarksJSON = ConvertTo-Json -InputObject $dataBookmarks -Depth 100
    Set-Content -Path $fileBookmarks -Value $dataBookmarksJSON -Encoding UTF8
}

if the script tries to create the directory structure, upon opening the Chrome, the files are overwritten as of my testing

@Ana06
Copy link
Member Author

Ana06 commented Jan 11, 2024

Extracting Google Chrome part to the following issues to allow more focused discussions in every of them:

@Ana06 Ana06 changed the title Configuration: Chrome & Cyberchef Configuration: Add Cyberchef to Chrome settings Jan 11, 2024
@Ana06 Ana06 removed this from the FLARE-VM 2023 Q4 milestone Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌀 FLARE-VM A package or feature to be used by FLARE-VM 💎 enhancement It is working, but it could be better
Projects
None yet
Development

No branches or pull requests

2 participants