Cleanup from master merge
This commit is contained in:
parent
541b9184bd
commit
ad38acaff3
|
@ -1,18 +1 @@
|
||||||
# Generated by Cargo
|
*.pyc
|
||||||
# will have compiled files and executables
|
|
||||||
/target/
|
|
||||||
|
|
||||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
|
||||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
|
||||||
Cargo.lock
|
|
||||||
|
|
||||||
# These are backup files generated by rustfmt
|
|
||||||
**/*.rs.bk
|
|
||||||
|
|
||||||
|
|
||||||
#Added by cargo
|
|
||||||
#
|
|
||||||
#already existing elements are commented out
|
|
||||||
|
|
||||||
/target
|
|
||||||
#**/*.rs.bk
|
|
||||||
|
|
11
Cargo.toml
11
Cargo.toml
|
@ -1,11 +0,0 @@
|
||||||
[package]
|
|
||||||
name = "desteg"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["pwarren"]
|
|
||||||
edition = "2018"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
rocket="0.4.*"
|
|
||||||
image="*"
|
|
||||||
tempfile="3.*"
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
# desteg
|
# desteg
|
||||||
A sily web API to add entropy to images in an attempt to destroy any steganography
|
A silly web API to add entropy to images in an attempt to destroy any steganography
|
||||||
|
|
||||||
|
curl -H "Content-Type: application/png" --data-binary @GPSPeedo1.png http://localhost:5002/desteg -o GPSPeedo1_Destegged.png
|
||||||
|
|
49
src/main.rs
49
src/main.rs
|
@ -1,49 +0,0 @@
|
||||||
#![feature(proc_macro_hygiene, decl_macro)]
|
|
||||||
|
|
||||||
#[macro_use] extern crate rocket;
|
|
||||||
|
|
||||||
//extern crate rand;
|
|
||||||
|
|
||||||
extern crate image;
|
|
||||||
//extern crate tempfile;
|
|
||||||
|
|
||||||
//use std::io;
|
|
||||||
|
|
||||||
use rocket::Data;
|
|
||||||
use rocket::response::content;
|
|
||||||
|
|
||||||
#[cfg(test)] mod tests;
|
|
||||||
|
|
||||||
#[get("/")]
|
|
||||||
fn index() -> &'static str {
|
|
||||||
"
|
|
||||||
Usage
|
|
||||||
|
|
||||||
POST /
|
|
||||||
|
|
||||||
accepts image data in the body of the requests, returns the
|
|
||||||
image with more entropy added to the least significant bits of each
|
|
||||||
colour channel.
|
|
||||||
|
|
||||||
EXMAPLE: curl --data-binary @file.jpg http://localhost:8000
|
|
||||||
"
|
|
||||||
}
|
|
||||||
|
|
||||||
#[post("/", data = "<incoming_image>")]
|
|
||||||
fn desteg(incoming_image: Data) -> image::DynamicImage {
|
|
||||||
|
|
||||||
let image_buffer = image::load_from_memory(incoming_image.peek()).unwrap();
|
|
||||||
|
|
||||||
image_buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
fn rocket() -> rocket::Rocket {
|
|
||||||
let my_rocket = rocket::ignite().mount("/", routes![index]);
|
|
||||||
my_rocket
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
rocket().launch();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
15
src/tests.rs
15
src/tests.rs
|
@ -1,15 +0,0 @@
|
||||||
use super::rocket;
|
|
||||||
use rocket::local::Client;
|
|
||||||
use rocket::http::{Status, ContentType};
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn check_index() {
|
|
||||||
let client = Client::new(rocket()).unwrap();
|
|
||||||
|
|
||||||
// Ensure the index returns what we expect.
|
|
||||||
let response = client.get("/").dispatch();
|
|
||||||
assert_eq!(response.status(), Status::Ok);
|
|
||||||
assert_eq!(response.content_type(), Some(ContentType::Plain));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue