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

Create content to automate SSA icons #13

Open
6 of 12 tasks
jgstew opened this issue Sep 29, 2019 · 3 comments
Open
6 of 12 tasks

Create content to automate SSA icons #13

jgstew opened this issue Sep 29, 2019 · 3 comments

Comments

@jgstew
Copy link
Owner

jgstew commented Sep 29, 2019

Look at automating the addition of Icons to content for display within the Self Service Application using REST API or Dashboard or other methods.

Can get an Icon from the content's prefetch statement on windows using: https://github.com/jgstew/tools/blob/master/CSharp/ExtractAssociatedIcon.bat

ToDo:

Examples:

Console Dashboard for SSA Icons:

PNG Image MIMEField:

<MIMEField>
    <Name>action-ui-metadata</Name>
    <Value>{"version":"66.208.49227","size":46641152,"icon":"data:image/png;base64,iVB....CC"}</Value>
</MIMEField>

Fixlet with SSA Icon:

https://github.com/jgstew/bigfix-content/blob/master/fixlet/Open%20Monitor%20Manual%20-%20PG279Q%20-%20Windows.bes

Client Relevance:

  • base64 encode file: (base64 encodes it) of concatenations of lines of files "setup.exe.ico"
  • fixlet name & icon: (values of headers "Subject" of it, ("<img alt='icon' height='64' src='" & it as string & "'>") of values of keys "icon" of jsons of values of headers "action-ui-metadata" of it) of fixlets of sites whose("Custom Site" = type of it)
  • get Mac App Icon filename: (it & ".icns") of (preceding text of last ".icns" of it | it) of strings "CFBundleIconFile" of dictionaries of files "Contents/Info.plist" of folders whose(name of it as lowercase ends with ".app") of folders "/Applications"
  • Get Mac App Icon pathname: (pathname of folders "Resources" of folders "Contents" of items 0 of it & "/" & item 1 of it) of (it, (it & ".icns") of (preceding text of last ".icns" of it | it) of strings "CFBundleIconFile" of dictionaries of files "Contents/Info.plist" of it) of folders whose(name of it as lowercase ends with ".app") of folders "/Applications"
  • Get Mac App Name & Icon pathname: ( preceding texts of lasts ".app" of names of it, (pathname of folders "Resources" of folders "Contents" of items 0 of it & "/" & item 1 of it) of (it, (it & ".icns") of (preceding text of last ".icns" of it | it) of strings "CFBundleIconFile" of dictionaries of files "Contents/Info.plist" of it) of it) of folders whose(name of it as lowercase ends with ".app") of folders "/Applications"
  • (preceding texts of lasts ".png" of names of it, sizes of it) of files ending in ".png" of folders "/tmp/_BigFix/Icons"
  • number of (concatenations of lines of it) of files ending in ".png" of folders "/tmp/_BigFix/Icons" of encodings "ISO-8859-1"
  • get icon files in Mac .app bundle: files whose(name of it as lowercase ends with ".icns") of folders "Contents/Resources" of folders whose(name of it as lowercase ends with ".app") of folders "/Applications"

Session Relevance:

  • number of fixlets with icons: number of mime fields "action-ui-metadata" of custom bes fixlets
  • icon data from fixlets: values of keys "icon" of jsons of mime fields "action-ui-metadata" of custom bes fixlets
  • icon HTML from fixlets: (links of it, ("<img alt='icon' height='64' src='" & it as string & "'>") of values of keys "icon" of jsons of mime fields "action-ui-metadata" of it) of custom bes fixlets
  • get icons from analysis results: ("<img src='data:image/png;base64," & it & "'>") of unique values of (substrings separated by ";;" of concatenations of values of it) of results of bes properties "base64 of Icons"
  • fixlets and tasks missing SSA Icons: (consider baselines too?) number of custom bes fixlets whose( (task flag of it OR fixlet flag of it) AND visible flag of it AND NOT exists mime fields "action-ui-metadata" of it AND exists default action of it)
    • there isn't session relevance to detect which are offers... need to file RFE for this
  • ID Name of fixlets/tasks: (id of it as string & " " & name of it) of custom bes fixlets whose( (task flag of it OR fixlet flag of it) AND visible flag of it AND NOT exists mime fields "action-ui-metadata" of it AND exists default action of it)

Mac Icon File Info:

Get Magic Literal:

Q: concatenations of (characters it) of (bytes 0 of it; bytes 1 of it; bytes 2 of it; bytes 3 of it) of files "/Applications/App Store.app/Contents/Resources/AppIcon.icns"
A: icns

Related:

@jgstew
Copy link
Owner Author

jgstew commented Oct 3, 2019

To get Mac App Icons in BigFix Console:

  1. Only run this on a few machines: https://github.com/jgstew/bigfix-content/blob/master/fixlet/Get%20PNG%20From%20All%20Applications%20ICNS%20Files%20-%20MacOS.bes
  2. Import and activate: https://github.com/jgstew/bigfix-content/blob/master/analyses/App%20Icons%20for%20SSA%20-%20Mac.bes
  3. Load Wizard/add to site: https://github.com/jgstew/bigfix-content/blob/master/dashboards/MacAppIconsForSSA.ojo

ToDo:

  • improve the icon harvesting fixlet to get the default icon better, seems to not get the actual default icon within the ICNS file as there can be more than one.
    • try the GetIcon binary on the .app bundle itself rather than converting the ICNS file to a PNG.
  • Improve the dashboard so an operator to click on an Icon, then pick a fixlet/task to add it to.
    • need session relevance to figure out candidate actions that could get Icons
      • names of fixlets whose( ( baseline flag of it OR task flag of it OR fixlet flag of it) AND visible flag of it) of bes custom sites whose(current console user whose(custom content flag of it) is contained by writer set of it)

@jgstew
Copy link
Owner Author

jgstew commented Oct 4, 2019

wow, this built-in command seems to do EXACTLY what I need to get the default icon out of an icns file into PNG format: https://www.macworld.com/article/1060156/sipsicns.html

sips -s format png --resampleHeightWidthMax 128 Calendar.icns --out /tmp/Calendar.icns128.png

I thought I had to use https://github.com/sveinbjornt/osxiconutils but it doesn't get the correct default icon: sveinbjornt/osxiconutils#5

@jgstew
Copy link
Owner Author

jgstew commented Jul 15, 2021

Interesting PDF icon:

https://www.iconpacks.net/free-icon/pdf-download-2617.html

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAH0lEQVQ4T2NkoBAwUqifYdQAhtEwYBgNA1A+Gvi8AAAmmAARf9qcXAAAAABJRU5ErkJggg=="/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant