Initial commit 💥

This commit is contained in:
Nemo 2021-07-15 23:50:42 +05:30
commit 67900d33a0
5 changed files with 555 additions and 0 deletions

11
HACKING.md Normal file
View File

@ -0,0 +1,11 @@
# HACKING
`fingerprint.php` does all the work. Just run it. versions.txt is generated from a list of all usable tags on the electron repo.
This includes all releases that were not:
1. nightly releases
2. beta releases
3. older than 0.24.0 (electron was called atom-shell before that)
All generated hashes are kept in `hashes/`.

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2021 Abhay Rana <me@captnemo.in>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

21
README.md Normal file
View File

@ -0,0 +1,21 @@
# electron-fingerprints
Generates fingerprints for electron version detection by downloading electron releases and generating checksums of the files contained in each release.
## why
You can use this to guess which electron version is being used in a given application.
A given electron version is (almost always) tightly bound to a node and chrome release as well, so
you get a better sense of what the application is running.
Written as the backend for [`which-electon`][we].
## usage
This is just the raw data files, see [which-electron][we] for a usable package.
## LICENSE
Released under WTFPL.
[we]: https://github.com/captn3m0/which-electron

69
fingerprint.php Normal file
View File

@ -0,0 +1,69 @@
<?php
// https://stackoverflow.com/a/54325258/368328
function rsearch($dir) {
$dir = new RecursiveDirectoryIterator($dir);
$dir->setFlags(RecursiveDirectoryIterator::SKIP_DOTS);
$ite = new RecursiveIteratorIterator($dir);
foreach($ite as $file) {
yield $file->getPathName();
}
}
function generateFingerprint($version, $output, $hash_file) {
$manifest = [];
$manifest['version'] = $version;
foreach(rsearch($output) as $file) {
$path = substr($file, strlen($output) + 1);
$manifest[$path] = sha1_file($file);
}
$json = json_encode($manifest, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
file_put_contents($hash_file, $json);
}
function download_release($url, $output) {
@unlink($output);
system("wget --quiet --max-redirect=5 '$url' -O /dev/shm/test.zip", $ret);
return ($ret === 0);
}
function extract_release($input, $output) {
$zip = new ZipArchive();
if (!$zip->open($input)) {
die("Download failed?");
}
`rm -rf $output`;
mkdir($output);
if(!$zip->extractTo($output)) {
die("Failed extraction");
}
$zip->close();
}
$archs = ['x64'];
$oses = ['linux', 'darwin', 'win32'];
foreach(file('versions.txt', FILE_IGNORE_NEW_LINES) as $version) {
foreach($oses as $os) {
foreach($archs as $arch) {
$hash_file = "hashes/$os-$arch-$version.json";
if (!file_exists($hash_file)) {
$zipfile = '/dev/shm/test.zip';
$output = '/dev/shm/electron';
$url = "https://github.com/electron/electron/releases/download/$version/electron-$version-$os-$arch.zip";
echo $url . PHP_EOL;
if (download_release($url, $zipfile)) {
extract_release($zipfile, $output);
generateFingerprint($version, $output, $hash_file);
} else {
echo "[DL:FAIL] $version\n";
}
}
}
}
}

441
versions.txt Normal file
View File

@ -0,0 +1,441 @@
v0.24.0
v0.25.0
v0.25.1
v0.25.2
v0.25.3
v0.26.0
v0.26.1
v0.27.0
v0.27.1
v0.27.2
v0.27.3
v0.28.0
v0.28.1
v0.28.2
v0.28.3
v0.29.0
v0.29.1
v0.29.2
v0.30.0
v0.30.1
v0.30.2
v0.30.3
v0.30.4
v0.30.5
v0.30.6
v0.30.7
v0.30.8
v0.31.0
v0.31.1
v0.31.2
v0.32.0
v0.32.1
v0.32.2
v0.32.3
v0.33.0
v0.33.1
v0.33.2
v0.33.3
v0.33.4
v0.33.5
v0.33.6
v0.33.7
v0.33.8
v0.33.9
v0.34.0
v0.34.1
v0.34.2
v0.34.3
v0.34.4
v0.34.5
v0.35.0
v0.35.1
v0.35.2
v0.35.3
v0.35.4
v0.35.5
v0.35.6
v0.36.0
v0.36.1
v0.36.10
v0.36.11
v0.36.12
v0.36.2
v0.36.3
v0.36.4
v0.36.5
v0.36.6
v0.36.7
v0.36.8
v0.36.9
v0.37.0
v0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