Compare commits
No commits in common. "bcd77d9ed6d5308799d25a69e87be189252580b7" and "d76ed2585dbbbe739a40e486994ea5b8cc4d6b1f" have entirely different histories.
bcd77d9ed6
...
d76ed2585d
8 changed files with 8 additions and 70 deletions
10
.drone.yml
10
.drone.yml
|
@ -1,10 +0,0 @@
|
||||||
---
|
|
||||||
kind: pipeline
|
|
||||||
type: docker
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: build
|
|
||||||
image: rust:latest
|
|
||||||
commands:
|
|
||||||
- cargo test
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,7 +2,6 @@
|
||||||
/imgs
|
/imgs
|
||||||
fif_*
|
fif_*
|
||||||
/old
|
/old
|
||||||
/.mypy_cache
|
|
||||||
*.sh
|
*.sh
|
||||||
!clippy.sh
|
!clippy.sh
|
||||||
cargo-timing*.html
|
cargo-timing*.html
|
||||||
|
|
|
@ -10,13 +10,6 @@
|
||||||
</Attribute>
|
</Attribute>
|
||||||
</value>
|
</value>
|
||||||
</entry>
|
</entry>
|
||||||
<entry key="/src/mimedb.rs">
|
|
||||||
<value>
|
|
||||||
<Attribute>
|
|
||||||
<option name="separator" value="	" />
|
|
||||||
</Attribute>
|
|
||||||
</value>
|
|
||||||
</entry>
|
|
||||||
<entry key="/src/parameters.rs">
|
<entry key="/src/parameters.rs">
|
||||||
<value>
|
<value>
|
||||||
<Attribute>
|
<Attribute>
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module type="CPP_MODULE" version="4">
|
<module type="CPP_MODULE" version="4">
|
||||||
<component name="FacetManager">
|
|
||||||
<facet type="Python" name="Python facet">
|
|
||||||
<configuration sdkName="Python 3.9" />
|
|
||||||
</facet>
|
|
||||||
</component>
|
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
@ -12,10 +7,8 @@
|
||||||
<excludeFolder url="file://$MODULE_DIR$/imgs" />
|
<excludeFolder url="file://$MODULE_DIR$/imgs" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/old" />
|
<excludeFolder url="file://$MODULE_DIR$/old" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/awful" />
|
<excludeFolder url="file://$MODULE_DIR$/awful" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/.mypy_cache" />
|
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="Python 3.9 interpreter library" level="application" />
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
|
@ -5,12 +5,12 @@ version = "0.2.6"
|
||||||
authors = ["Lynnesbian <lynne@bune.city>"]
|
authors = ["Lynnesbian <lynne@bune.city>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
rust-version = "1.43.0" # cached breaks on 1.42.0, i think it needs https://github.com/rust-lang/rust/pull/67642/
|
rust-version = "1.43.0" # cached requires 1.42.0
|
||||||
repository = "https://git.bune.city/lynnesbian/fif"
|
repository = "https://git.bune.city/lynnesbian/fif"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
keywords = ["mime", "mimetype", "utilities", "tools"]
|
keywords = ["mime", "mimetype", "utilities", "tools"]
|
||||||
categories = ["command-line-utilities"]
|
categories = ["command-line-utilities"]
|
||||||
exclude = [".idea/", "Cross.toml", "*.sh", "*.py", ".drone.yml"]
|
exclude = [".idea/", "Cross.toml", "*.sh"]
|
||||||
#resolver = "2"
|
#resolver = "2"
|
||||||
#license-file = "LICENSE"
|
#license-file = "LICENSE"
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@ use crate::mimedb::MimeDb;
|
||||||
use crate::parameters::OutputFormat;
|
use crate::parameters::OutputFormat;
|
||||||
use crate::scanerror::ScanError;
|
use crate::scanerror::ScanError;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
use env_logger::Env;
|
|
||||||
|
|
||||||
mod extensionset;
|
mod extensionset;
|
||||||
mod findings;
|
mod findings;
|
||||||
|
@ -216,10 +215,7 @@ fn init_db() {
|
||||||
fn main() {
|
fn main() {
|
||||||
let args = parameters::Parameters::parse();
|
let args = parameters::Parameters::parse();
|
||||||
|
|
||||||
let mut builder = env_logger::Builder::from_env(
|
let mut builder = env_logger::Builder::from_default_env();
|
||||||
Env::new().filter_or("RUST_LOG", "WARN")
|
|
||||||
);
|
|
||||||
|
|
||||||
builder
|
builder
|
||||||
// .format(|buf, r| writeln!(buf, "{} - {}", r.level(), r.args()))
|
// .format(|buf, r| writeln!(buf, "{} - {}", r.level(), r.args()))
|
||||||
.format_module_path(false) // don't include module in logs, as it's not necessary
|
.format_module_path(false) // don't include module in logs, as it's not necessary
|
||||||
|
|
|
@ -25,6 +25,11 @@ cfg_if! {
|
||||||
fn init() -> Self {
|
fn init() -> Self {
|
||||||
let mut info = infer::Infer::new();
|
let mut info = infer::Infer::new();
|
||||||
|
|
||||||
|
// jpeg2000 support because why the stinch not
|
||||||
|
info.add("image/jpeg2000", ".jp2", |buf| {
|
||||||
|
buf.len() > 23 && buf[..23] == b"\x00\x00\x00\x0C\x6A\x50\x20\x20\x0D\x0A\x87\x0A\x6A\x70\x32\x20"[..]
|
||||||
|
});
|
||||||
|
|
||||||
info.add("application/vnd.oasis.opendocument.text", "odt", |buf| {
|
info.add("application/vnd.oasis.opendocument.text", "odt", |buf| {
|
||||||
open_document_check(buf, "text")
|
open_document_check(buf, "text")
|
||||||
});
|
});
|
||||||
|
|
38
test.py
38
test.py
|
@ -1,38 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import re
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
def main():
|
|
||||||
match = re.search(
|
|
||||||
r'rust-version ?= ?"([\d.]+)"',
|
|
||||||
open("Cargo.toml", "r").read(-1)
|
|
||||||
)
|
|
||||||
|
|
||||||
if not match:
|
|
||||||
print("Couldn't find rust-version")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
versions = [match.group(1), "stable", "beta", "nightly"]
|
|
||||||
backends = ["xdg-mime", "infer"]
|
|
||||||
|
|
||||||
done = 0
|
|
||||||
target = len(versions) * len(backends) * 2
|
|
||||||
|
|
||||||
for version in versions:
|
|
||||||
for backend in backends:
|
|
||||||
print(f"[{version}, {backend}] Tests")
|
|
||||||
subprocess.run(f"cargo +{version} test --features={backend}-backend".split(" "))
|
|
||||||
done += 1
|
|
||||||
print(f"Success - {done} of {target} complete")
|
|
||||||
|
|
||||||
print(f"[{version}, {backend}] Scanning imgs")
|
|
||||||
subprocess.run(f"cargo +{version} run --release --features={backend}-backend -- -E images imgs".split(" "))
|
|
||||||
done += 1
|
|
||||||
print(f"Success - {done} of {target} complete")
|
|
||||||
|
|
||||||
print("Done! You might want to run cargo clean...")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
|
|
Loading…
Reference in a new issue