Skip to content

Commit

Permalink
testing some modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
qt1b committed Oct 2, 2024
1 parent 36dc3cf commit c815c1a
Show file tree
Hide file tree
Showing 32 changed files with 705 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@
[submodule "themes/hello-friend-ng"]
path = themes/hello-friend-ng
url = https://github.com/rhazdon/hugo-theme-hello-friend-ng.git
[submodule "themes/gokarna"]
path = themes/gokarna
url = https://github.com/526avijitgupta/gokarna.git
[submodule "themes/terminal"]
path = themes/terminal
url = https://github.com/panr/hugo-theme-terminal.git
26 changes: 24 additions & 2 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,30 @@
baseURL = 'http://qt1b.github.io/'
languageCode = 'en-us'
title = "qt1b's personal page"
theme = "hello-friend-ng"
theme = ["PaperMod", "gokarna","hello-friend-ng","terminal"] # "terminal" #"gokarna"

[menus]
[[menus.main]]
name = 'CTF Writeups'
pageRef = '/writeups/asis/2024/detic'
weight = 100
[[menus.main]]
name = 'misc'
pageRef = '/writeups/pwn'
parent = 'CTF Writeups'
weight = 3
[[menus.main]]
name = 'misc'
pageRef = '/writeups/rev'
parent = 'CTF Writeups'
weight = 2
[[menus.main]]
name = 'misc'
pageRef = '/writeups/misc'
parent = 'CTF Writeups'
weight = 1


custom_css = ["css/custom.css"]
# used to center / redimension images in specific cases
[markup.goldmark.renderer]
unsafe = true
6 changes: 0 additions & 6 deletions content/posts/test.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
+++
title = "Asis 2024 - misc / detic"
date = 2022-08-07T12:32:23+09:30
tags = ['ctf','misc','asis','2024']
draft = false
toc = false # don't make a table of contents
+++
# misc / detic
- name : detic
- category : misc

## Objective
The goal of this challenge is to find a point on Earth that is equidistant from three given locations on earth.

When we connect to the instance, we get the following message:
Expand Down Expand Up @@ -34,6 +38,8 @@ The main difficulty of this challenge is the fact that we are dealing with coord

While it is easy to find the middle of a triangle in a two dimmensional plane, the calculation reveals itself to be more complex when dealing with a sherical surface.

## 'Naive' method

First of all, we will need to convert our coordinates to carthesian coordinates. To do this, we create the following functions:
```py
def lat_lon_to_cartesian(lat, lon):
Expand All @@ -53,7 +59,12 @@ def cartesian_to_lat_lon(x, y, z):
```
Our initial attempt is to get the middle coordinates of these three points, then normalize it and then multiply it by the radius of the earth.

![](/img/asis2024/Shere_1.png)
<img src="/img/asis2024/Shere_1.png" style="
width: 30%;
heigth: auto;
display: block;
margin-left: auto;
margin-right: auto">

```py
def normalize(x,y,z):
Expand All @@ -71,11 +82,17 @@ def solve(P1,P2,P3):
```
While the given result is coherent, it is not what is expected by the instance, and so the search continues.

## The right method
We then find [this article](http://www.geomidpoint.com/calculation.html), that explains how to compute a **geographic** midpoint with a given number of coordinates, but not a **geometrical** midpoint, which is instead what we're looking for.

After further research, we found [this paper on spherical geometry](http://www.verniana.org/volumes/02/LetterSize/SphericalGeometry.pdf), which provides the formula we were looking for.

![](/img/asis2024/Shere_2.png)
<img src="/img/asis2024/Shere_2.png" style="
width: 30%;
heigth: auto;
display: block;
margin-left: auto;
margin-right: auto">

By applying the described calculations, we get the following code:
```py
Expand Down
10 changes: 10 additions & 0 deletions layouts.bak.d/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{{ define "main" }}
<div class="post">
<h1 class="post-title">404 — {{ $.Site.Params.missingContentMessage | default "Page not found..." }}</h1>

<div class="post-content">
<a href="{{ "/" | absURL }}">{{ $.Site.Params.missingBackButtonLabel | default "Back to home page" }}&nbsp;→</a>
</div>

</div>
{{ end }}
27 changes: 27 additions & 0 deletions layouts.bak.d/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="{{ $.Site.Language }}">
<head>
{{ block "title" . }}
<title>{{ if .IsHome }}{{ $.Site.Title }}{{ else }}{{ .Title }} :: {{ $.Site.Title }}{{ end }}</title>
{{ end }}
{{ partial "head.html" . }}
</head>
<body>
{{ $container := cond ($.Site.Params.FullWidthTheme | default false) "container full" (cond ($.Site.Params.CenterTheme | default false) "container center" "container") }}

<div class="{{- $container -}}{{- cond ($.Site.Params.oneHeadingSize | default false) " headings--one-size" "" }}">

{{ partial "header.html" . }}

<div class="content">
{{ block "main" . }}
{{ end }}
</div>

{{ block "footer" . }}
{{ partial "footer.html" . }}
{{ end }}
</div>

</body>
</html>
66 changes: 66 additions & 0 deletions layouts.bak.d/_default/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{{ define "main" }}
{{ if .Content }}
<div class="index-content {{ if .Params.framed -}}framed{{- end -}}">
{{ .Content }}
</div>
{{ end }}
<div class="posts">
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}

{{ $PageContext := . }}
{{ if .IsHome }}
{{ $PageContext = .Site }}
{{ end }}
{{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }}

{{ range $paginator.Pages }}
<article class="post on-list">
<h2 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
</h2>

<div class="post-meta">
{{- if .Date -}}
<time class="post-date">
{{- .Date.Format "2006-01-02" -}}
</time>
{{- end -}}
{{- with .Params.Author -}}
<span class="post-author">{{ . }}</span>
{{- end -}}
</div>

{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
{{- . -}}
</a>&nbsp;
{{ end }}
</span>
{{ end }}

{{ partial "cover.html" . }}

<div class="post-content">
{{ if .Params.showFullContent }}
{{ .Content }}
{{ else if .Description }}
<p>{{ .Description | markdownify }}</p>
{{ else }}
{{ .Summary }}
{{ end }}
</div>

{{ if not .Params.showFullContent }}
<div>
<a class="read-more button inline" href="{{ .RelPermalink }}">{{ $.Site.Params.ReadMore }}</a>
</div>
{{ end }}
</article>
{{ end }}

{{ partial "pagination.html" . }}
</div>
{{ end }}
56 changes: 56 additions & 0 deletions layouts.bak.d/_default/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{{ define "main" }}
{{ with .Content }}
<div class="index-content">
{{ . }}
</div>
{{ end }}
<div class="posts">
{{ range .Paginator.Pages }}
<article class="post on-list">
<h2 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
</h2>
<div class="post-meta">
{{- if .Date -}}
<time class="post-date">
{{- .Date.Format "2006-01-02" -}}
</time>
{{- end -}}
{{- with .Params.Author -}}
<span class="post-author">{{- . -}}</span>
{{- end -}}
</div>

{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}">
{{- . -}}
</a>&nbsp;
{{ end }}
</span>
{{ end }}

{{ partial "cover.html" . }}

<div class="post-content">
{{ if .Params.showFullContent }}
{{ .Content }}
{{ else if .Description }}
<p>{{ .Description | markdownify }}</p>
{{ else }}
{{ .Summary }}
{{ end }}
</div>

{{ if not .Params.showFullContent }}
<div>
<a class="read-more button inline" href="{{ .RelPermalink }}">{{ $.Site.Params.ReadMore }}</a>
</div>
{{ end }}
</article>
{{ end }}

{{ partial "pagination.html" . }}
</div>
{{ end }}
40 changes: 40 additions & 0 deletions layouts.bak.d/_default/rss.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>{{ .Summary | html }}</description>
<content>{{ .Content | html }}</content>
</item>
{{ end }}
</channel>
</rss>
57 changes: 57 additions & 0 deletions layouts.bak.d/_default/single.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{ define "main" }}
<article class="post">
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
</h1>
<div class="post-meta">
{{- if .Date -}}
<time class="post-date">
{{- .Date.Format "2006-01-02" -}}
{{- if $.Site.Params.showLastUpdated -}}
[{{- or $.Site.Params.updatedDatePrefix "Updated" -}} :: {{- .Lastmod.Format "2006-01-02" -}}]
{{- end -}}
</time>
{{- end -}}
{{- with .Params.Author -}}
<span class="post-author">{{ . }}</span>
{{- end -}}
{{- if and (.Param "readingTime") (eq (.Param "readingTime") true) -}}
<span class="post-reading-time">{{ .ReadingTime }} {{ $.Site.Params.minuteReadingTime | default "min read" }} ({{ .WordCount }} {{ $.Site.Params.words | default "words" }})</span>
{{- end -}}
</div>

{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>&nbsp;
{{ end }}
</span>
{{ end }}
{{ partial "cover.html" . }}

{{ if (.Params.Toc | default .Site.Params.Toc) }}
<div class="table-of-contents">
<h2>
{{ (.Params.TocTitle | default .Site.Params.TocTitle) | default "Table of Contents" }}
</h2>
{{ .TableOfContents }}
</div>
{{ end }}

<div class="post-content">
{{- with .Content -}}
<div>
{{ . | replaceRE "(<h[1-9] id=\"([^\"]+)\".+)(</h[1-9]+>)" `${1}<a href="#${2}" class="hanchor" ariaLabel="Anchor">#</a> ${3}` | safeHTML }}
</div>
{{- end -}}
</div>

{{ if eq .Type $.Site.Params.contentTypeName }}
{{ partial "posts_pagination.html" . }}
{{ end }}

{{ if not (.Params.hideComments | default false) }}
{{ partial "comments.html" . }}
{{ end }}
</article>
{{ end }}
Loading

0 comments on commit c815c1a

Please sign in to comment.