Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logger #346

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions logs/logfile.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
File uploaded successfully: 微信图片_20240110091111.jpg
File uploaded successfully: 张郁璇-回执单.jpg
File uploaded successfully: config.json
File uploaded successfully: config.json
File download successfully: /var/www/html/uploadfiles/test.txt
2024/1/27 下午6:35:53 - File uploaded successfully: config.json
14 changes: 14 additions & 0 deletions source/modules/attacklogger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// attacklogger.js
const fs = require('fs');
function appendToLogFile(message, filePath = "/home/kali/桌面/antSword/logs/logfile.log") {
const logMessage = `${new Date().toLocaleString()} - ${message}\n`;
fs.appendFile(filePath, logMessage, (err) => {
if (err) {
console.error(`Error appending to log file (${filePath}):`, err);
}
});
}

module.exports = {
appendToLogFile,
};
Loading