Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityNighthawk M7 Pro im Test: Flexibler, aber teurer 5G-Router(21.09.2026 um 10:30 Uhr)
Sichere ProgrammierungNeue Gmail-Funktion: So sparst du jetzt Zeit bei Einmalcodes(21.09.2026 um 10:00 Uhr)
Sichere ProgrammierungYour GIF exporter is fine — the container is the problem(21.09.2026 um 10:01 Uhr)
Sichere ProgrammierungCSS, Motion, or GSAP? I Choose by Who Owns the Animation(21.09.2026 um 10:12 Uhr)
Windows Tipps & SecurityNighthawk M7 Pro im Test: Flexibler, aber teurer 5G-Router(21.09.2026 um 10:30 Uhr)
Sichere ProgrammierungNeue Gmail-Funktion: So sparst du jetzt Zeit bei Einmalcodes(21.09.2026 um 10:00 Uhr)
Sichere ProgrammierungYour GIF exporter is fine — the container is the problem(21.09.2026 um 10:01 Uhr)
Sichere ProgrammierungCSS, Motion, or GSAP? I Choose by Who Owns the Animation(21.09.2026 um 10:12 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Creating a PHP, Go, and Python Quine Relay

I have created a Quine relay involving PHP, Go, and Python, and I’m here to explain how it works. This is the code for QuineRelay.php: <?=eval($_='print "package main;import\42fmt\42;func m…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

I have created a Quine relay involving PHP, Go, and Python, and I’m here to explain how it works.

This is the code for QuineRelay.php:




<?=eval($_='print "package main;import\42fmt\42;func main(){fmt.Print(\140print(r\47\47\47<?=eval(\44_=\47$_\47);\47\47\47)\140)}";');






Yes, it probably looks like total nonsense. I will explain it step by step.

Now, you can see many things like \42. In PHP, inside double quotes, these are treated as octal ASCII codes and converted into characters.

For example, a double quote is ASCII code 34, which is 42 in octal.

Therefore, \42 will be a double quote.



I have created a conversion table below:




























Octal ASCII Code Character
42 34 " (Double Quote)
47 39 ' (Single Quote)
140 96 Backtick


(I couldn't put the actual backtick in the table without breaking the markdown 😅)



The advantage of using this octal notation is that these characters do not need to be escaped when they are included in Go or Python strings.

The difficult part of a Quine is how to handle characters like double quotes or single quotes that require escaping when they appear within a string, but by using octal notation, the need for escaping is eliminated.



Now, notice that the variable $_ is declared as an argument for the eval function at the beginning.

Let's look at the content of variable $_. Since $_ is enclosed in single quotes, the octal notation is treated literally as backslashes and numbers.




// inside $_
print "package main;import\42fmt\42;func main(){fmt.Print(\140print(r\47\47\47<?=eval(\44_=\47$_\47);\47\47\47)\140)}";






This code is then eval'ed. Since the string passed to print is enclosed in double quotes, the conversion from octal to ASCII occurs this time.

Also, $_ appears toward the end within the double quotes. In PHP, variable names inside double quotes are expanded with the value, so the second $_ will be expanded as the actual content of the variable.

The expansion of this $_ is the key trick to this Quine.

Running this PHP code outputs the following Go code:




package main;import"fmt";func main(){fmt.Print(`print(r'''<?=eval($_='print "package main;import\42fmt\42;func main(){fmt.Print(\140print(r\47\47\47<?=eval(\44_=\47$_\47);\47\47\47)\140)}";');''')`)}






Since escaping line breaks is difficult, I used semicolons to make it a one-liner of Go (When you write Go, you don't usually use semicolons at the end of statements, but Go compiler apparently adds them. Here I add semicolons manually to achieve the one-liner).

Also, by using backticks for the string, I can include single and double quotes within the string.



Running this Go code outputs the following Python code:




print(r'''<?=eval($_='print "package main;import\42fmt\42;func main(){fmt.Print(\140print(r\47\47\47<?=eval(\44_=\47$_\47);\47\47\47)\140)}";');''')






It is relatively straightforward, but by using ''', I can use single quotes within the string, and by using r''', I avoid the conversion from octal to ASCII.



Running this Python code brings us back to the original PHP.




<?=eval($_='print "package main;import\42fmt\42;func main(){fmt.Print(\140print(r\47\47\47<?=eval(\44_=\47$_\47);\47\47\47)\140)}";');









Summary



I thought a three-language Quine relay would be very difficult, but once I started writing it, it turned out to be simpler than expected.

I hope this article helps you read/write more quines 🙂

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Creating a PHP, Go, and Python Quine Relay

Thematisch verwandte Begriffe: Creating, Python, Quine, Relay · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

© 2015 - 2026 tsecurity.de — Nachrichten- & Content-Portal. Alle Rechte vorbehalten.

SSL 256-bit DSGVO Konform
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-94030 | A security vulnerability has been detected in SerenityOS up to 3d83e4509…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick