Skip to content

Commit

Permalink
Readme - how to
Browse files Browse the repository at this point in the history
  • Loading branch information
joaooliveirapro committed Jan 24, 2025
1 parent a211af4 commit f2663d4
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 3 deletions.
60 changes: 57 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,64 @@
SFTP Guard is a custom CLI script that checks files in SFTP servers for their updated time. This basic check is important to ensure dependable tools run with the most up to date data.

## Features
- Regex match to include/exclude paths
- 🔎 Regex match to include/exclude paths
- ⚡ Dynamic regex strings (use {yyyy}, {mm}, {dd} to create dynamic regex strings before regex compilation). {yyyy} gets replaced with the current year, {mm} with current month (with leading 0) and {dd} current day (with leading 0).
```json
Using the following regex pattern:
"(?si)Dynamic_Filename_{yyyy}{mm}{dd}.*"

will result in the following regex compilation (on the day 24 Jan 2025)
"(?si)Dynamic_Filename_20240124.*"
```


## Usage
You will need to create a `clients.json` file with the following properties. This file must be in the same directory as the executable.
```json

[
"client_name": "Client",
"treshold_hours": 2, // If a file has been modified over this treshold, then it will be highlighted on the table.
"feeds": [
{
"feed_name": "some name",
"host": "files.mysftpserver.com",
// If the filename is known and static, use this for faster results.
"filepaths": [
"/path/to/my/file.xml"
],
// If all files in a directory must be considered, add the directory path here. It's not recursive.
"directories": [
"/list/all/here/",
"/list/all/here/too"
],
// For more complex file lookup use a regex match pattern. Can also use {yyyy}, {mm}, {dd} for dynamic regex string compilation.
"regex": [
{
// Directory to apply the regex lookup
"directory": "/path/to/dir/",
// Regex string to match with each filename
"patterns": [
"(?si)Dynamic_Filename_{yyyy}{mm}{dd}.*"
]
}
],
// 22 for SFTP or 21 for FTP
"port": 22,
"username": "<sftp_username>",
"password": "<sftp_password>"
}
]
]

```

## Output
A table is shown with
![example output](https://github.com/joaooliveirapro/sftpguard/blob/main/assets/example1.png)

This is also exported as `data.txt`.

# Important
Won't work on it's own as it's a custom script for my work. This is only to showcase my golang skills.

### License
The MIT License (MIT)
Binary file added assets/example1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f2663d4

Please sign in to comment.