I have modified version of getnewsgroupslist.js with optional
authentication support because use nntp.aioe.org server that don't need it.
http://paste.debian.net/1152067/
I share here because can be useful for another people
thanks!
--- getnewsgrouplist.js 2019-12-01 00:02:31.000000000 -0300
+++ ../mods/getnewsgrouplist.js 2020-06-14 16:36:18.134989504 -0300
@@ -2,21 +2,39 @@
"use strict";
-if(argc < 3) {
- print("usage: " + js.exec_file + " <user> <password> <host> [port] [pattern]");
+if(argc < 1) {
+ print("usage: " + js.exec_file + " -h <host> -p [port] -a [user:pass] -t [pattern]");
exit(0);
}
+var host = "";
+var port = 119;
+var auth = "";
+var name = "";
+var pass = "";
+var pattern = "";
+
+for(var i=0;i<argc;i++) {
+ switch (argv[i].toLowerCase()) {
+ case "-h":
+ host = argv[++i];
+ break;
+ case "-p":
+ port = argv[++i];
+ break;
+ case "-a":
+ auth = argv[++i];
+ break;
+ case "-t":
+ pattern = argv[++i];
+ break;
+ default:
+ // compatibilty no -params?
+ host = argv[0];
+ }
+}
+
var socket = new Socket();
-var name = argv[0];
-var pass = argv[1];
-var host = argv[2];
-var port = argv[3];
-var pattern = argv[4];
-if(!pattern)
- pattern = "";
-if(!port)
- port = 119;
if(!socket.connect(host,port)) {
printf("!Error %d connecting to %s port %d\r\n"
,socket.last_error,host,port);
@@ -27,13 +45,25 @@ if(parseInt(resp, 10) != 200) {
alert("Unexpected response: " + resp);
exit();
}
-socket.sendline("AUTHINFO USER " + name);
-resp = socket.recvline();
-socket.sendline("AUTHINFO PASS " + pass);
-resp = socket.recvline();
-if(parseInt(resp, 10) != 281) {
- alert("Unexpected response: " + resp);
- exit();
+if (auth != "") {
+ if (auth.indexOf(':') > 0) {
+ name = auth.split(':')[0];
+ pass = auth.split(':')[1];
+ }
+ else {
+ printf("!Error auth settings '%s', use -a username:password syntax\r\n", auth);
+ exit();
+ }
+
+
+ socket.sendline("AUTHINFO USER " + name);
+ resp = socket.recvline();
+ socket.sendline("AUTHINFO PASS " + pass);
+ resp = socket.recvline();
+ if(parseInt(resp, 10) != 281) {
+ alert("Unexpected response: " + resp);
+ exit();
+ }
}
socket.sendline("LIST NEWSGROUPS");
resp = socket.recvline();
---
ï¿ Synchronet ï¿ Dock Sud BBS TLD 24 HS - bbs.docksud.com.ar