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

ArchLinux PKGBUILD #17

Open
noraj opened this issue Apr 4, 2021 · 11 comments
Open

ArchLinux PKGBUILD #17

noraj opened this issue Apr 4, 2021 · 11 comments
Labels
enhancement New feature or request

Comments

@noraj
Copy link
Owner

noraj commented Apr 4, 2021

ArchLinux PKGBUILD

@noraj noraj added the enhancement New feature or request label Apr 4, 2021
@D3vil0p3r
Copy link
Contributor

D3vil0p3r commented Oct 19, 2022

ArchLinux PKGBUILD

Hello @noraj Happy to meet you also here in this your wonderful project. If you wish, I can try to make a PKGBUILD for this. It could be very nice having it in some Arch repos.
Just need to understand the name of the package: like OSERT or SecuReport or others.

@noraj
Copy link
Owner Author

noraj commented Oct 19, 2022

Hi, thanks. osert is a good idea.

@D3vil0p3r
Copy link
Contributor

Hi, thanks. osert is a good idea.

Just some considerations:

  • I'm noting in Arch that from pandoc pkg the eisvogel template is not provided anymore, so it must be retrieved from AUR or manually from its git repo. Could be good to insert eisvogel.latex file in your OSERT repo?
  • Currently my approach on PKGBUILD was installing the src files (the .md ones) to /usr/share/osert and, according the logic of generate.rb, the output will be stored in /usr/share/osert/output folder. Since for storing output, privileges are needed, the user should run osert by sudo. For avoiding this, could I try to edit generate.rb in order that, when the user selects the preferred .md file, it will be copied in its current or $home folder, the tool will inform the user to write the .md report and, when he/she wrote it, to run a command like osert -i OSCP-xxx.md -o OSCP-xxx.pdf, so the user can edit the .md file with its exam evidences, and then, I would like to add a -i/-o or --input/--output arguments so that the user can save the .pdf in its preferred location (and avoid to save it in /usr subfolders)? Once done I can make a PR for it

@D3vil0p3r
Copy link
Contributor

D3vil0p3r commented Oct 19, 2022

Here the current PKGBUILD (currently, as described in the first bullet above, we need to retrieve eisvogel manually, unless it will be brought on this repository or obtained by the PKGBUILD in some efficient manner:

pkgname=osert
pkgver=69.8dc1a32
pkgrel=1
pkgdesc="Markdown Templates for Offensive Security exam reports."
arch=('any')
url='https://github.com/noraj/OSCP-Exam-Report-Template-Markdown'
license=('GPL3')
depends=('p7zip' 'pandoc' 'texlive-core' 'texlive-fontsextra' 'texlive-latexextra' 'xdg-utils')
makedepends=('git' 'unzip')
source=("git+https://github.com/noraj/OSCP-Exam-Report-Template-Markdown.git"
        "https://github.com/Wandmalfarbe/pandoc-latex-template/releases/download/v2.0.0/Eisvogel.tar.gz")
sha256sums=('SKIP'
            'c9bf5d7019b65a28b397cb1ac12676bce11f5badb10a156098073950a07d3e37')

pkgver() {
  cd OSCP-Exam-Report-Template-Markdown/
  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

prepare(){
  tar -zxvf Eisvogel.tar.gz
}

package() {
  mkdir -p "$pkgdir/usr/share/$pkgname"
  mkdir -p "$pkgdir/usr/bin"
  mkdir -p "$pkgdir/usr/share/pandoc/data/templates/"
  
  mv eisvogel.latex "$pkgdir/usr/share/pandoc/data/templates/"

  cp -rf "${srcdir}/OSCP-Exam-Report-Template-Markdown/src" "${pkgdir}/usr/share/$pkgname/"
  install -Dm 755 -t "$pkgdir/usr/share/$pkgname/" "${srcdir}/OSCP-Exam-Report-Template-Markdown/generate.rb"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
exec /usr/share/$pkgname/generate.rb "\$@"
EOF

  chmod a+x "$pkgdir/usr/bin/$pkgname"
}

PS: about the 2nd bullet point of my previous comment, I implemented that approach on the Pull Request I opened on generate.rb.

Instead of textlive-most that consists in 12 packages: 1) texlive-bibtexextra 2) texlive-core 3) texlive-fontsextra 4) texlive-formatsextra 5) texlive-games 6) texlive-humanities 7) texlive-latexextra 8) texlive-music 9) texlive-pictures 10) texlive-pstricks 11) texlive-publishers 12) texlive-science, I identified the three needed packages for OSERT: texlive-core, texlive-fontsextra and texlive-latexextra. In this way the user can keep just the texlive packages he/she needs.

@noraj
Copy link
Owner Author

noraj commented Oct 20, 2022

I'm noting in Arch that from pandoc pkg the eisvogel template is not provided anymore, so it must be retrieved from AUR or manually from its git repo. Could be good to insert eisvogel.latex file in your OSERT repo?

You should retrieve it from the git and add it in sources.

Ref.

Currently my approach on PKGBUILD was installing the src files (the .md ones) to /usr/share/osert and, according the logic of generate.rb, the output will be stored in /usr/share/osert/output folder. Since for storing output, privileges are needed, the user should run osert by sudo. For avoiding this, could I try to edit generate.rb in order that, when the user selects the preferred .md file, it will be copied in its current or $home folder, the tool will inform the user to write the .md report and, when he/she wrote it, to run a command like osert -i OSCP-xxx.md -o OSCP-xxx.pdf, so the user can edit the .md file with its exam evidences, and then, I would like to add a -i/-o or --input/--output arguments so that the user can save the .pdf in its preferred location (and avoid to save it in /usr subfolders)? Once done I can make a PR for it

Good point, I should think about that.

@D3vil0p3r
Copy link
Contributor

D3vil0p3r commented Oct 20, 2022

I'm noting in Arch that from pandoc pkg the eisvogel template is not provided anymore, so it must be retrieved from AUR or manually from its git repo. Could be good to insert eisvogel.latex file in your OSERT repo?

You should retrieve it from the git and add it in sources.

Ref.

Currently my approach on PKGBUILD was installing the src files (the .md ones) to /usr/share/osert and, according the logic of generate.rb, the output will be stored in /usr/share/osert/output folder. Since for storing output, privileges are needed, the user should run osert by sudo. For avoiding this, could I try to edit generate.rb in order that, when the user selects the preferred .md file, it will be copied in its current or $home folder, the tool will inform the user to write the .md report and, when he/she wrote it, to run a command like osert -i OSCP-xxx.md -o OSCP-xxx.pdf, so the user can edit the .md file with its exam evidences, and then, I would like to add a -i/-o or --input/--output arguments so that the user can save the .pdf in its preferred location (and avoid to save it in /usr subfolders)? Once done I can make a PR for it

Good point, I should think about that.

I edited my comment above with the updated PKGBUILD code. Now it retrieves and stores eisvogel.latex automatically. In the Pull Request of the repo, you can find the generate.rb updated with the file input/output approach. The following is a screen of the osert -h command:
image

@D3vil0p3r
Copy link
Contributor

D3vil0p3r commented Oct 23, 2022

I just updated the code in the PR. I hope it could be good for you @noraj

Now the user for first chooses the certification and then only the templates related to the chosen certification are shown. I used a nested array of objects. Then, each certification and some related output are colored according to the original OffSec certifications badge colors.

Also, now when the user inserts its OSID and Author (email address), it is automatically added in the .md file so it does not need to change this information manually. Also the date field in the .md file is automatically filled with the current date.

image

When run the command quoted in the screen above, the result will be the following with already author, OSID and current date information written:
image

@noraj
Copy link
Owner Author

noraj commented Oct 24, 2022

I'll review and modify #35 soon. Thanks for your great PR.

@D3vil0p3r
Copy link
Contributor

I'll review and modify #35 soon. Thanks for your great PR.

You're welcome.

@noraj
Copy link
Owner Author

noraj commented Oct 31, 2022

I made a PR on BA with a cleaner PKGBUILD https://github.com/BlackArch/blackarch/pull/3569/files

@D3vil0p3r
Copy link
Contributor

I made a PR on BA with a cleaner PKGBUILD https://github.com/BlackArch/blackarch/pull/3569/files

When the PR will be merged to BA repo, I will test it on Athena OS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants