HubBackup.v.1.0.LUA5-TTB
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

HubBackup.v.1.0.LUA5-TTB

Started by TTB, 27 March, 2006, 16:12:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TTB

Description:

-- HubBackup v1.0 in LUA5
-- Create a backup... a backup for your hub! Where will the backup be stored? --->> IN YOUR MAILBOX!
-- Created by TTB on 27 March 2006
-- For PtokaX 0.3.3.0 or higher
----------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
--------------------------------------------------------------------
--[[ 
How does it work and what do we need?

You will be able to backup your entire hub with ONE command! You only need to set everything right. This package has all files included! What do we have:
A. Blat v2.5.0 w/GSS encryption (built : Sep 14 2005 22:46:29)? ---> More information can be found on www.blat.net
B. RAR 3.20 shareware version, rar.exe to pack your hub. ---> More information can be found on www.rarlab.com
C. The LUA file to call blat with your settings! 

Blat is a program that will send the mail by DOS command line (cmd.exe). Of course we will add an attachment (the hub) when the backup will be made.
Now we need to config this... Plz go to the settings part.

Installation:
A. Extract the package in your scripts directory in your current hub.
B. Run the script in PtokaX.
NOTE: If the script doesn't work with error:? "cmail.txt does not exist" (in log file), then you need to copy your hub to a directory like c:\hub (not too much subdirs).

]]--

-- For your information, this is how Blat is used:
-- blat -install <smpt> <frommail> [-5 [- [- [- [- ]]]]]
-- blat <contentfile> -to <tomail> -f <frommail> -s "Subject" -server <smtp> -debug -log <logfile> -timestamp -attach <attachment>


You can download it here:? http://ptxscriptdb.psycho-chihuahua.net//download.php?view.221

TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

Psycho_Chihuahua

Very nice script TTB, but is it possible to add authentication details (Login Name and password ) for Mailserver that require it?

Example:
2006.03.29 17:38:11 (Wed): The SMTP server does not like the name me@myhost.com.
Have you set the 'To:' field correctly, or do you need authorization (-u/-pw) ?
2

PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

TTB

Quote from: Psycho_Chihuahua on 29 March, 2006, 17:42:45
Very nice script TTB, but is it possible to add authentication details (Login Name and password ) for Mailserver that require it?

Example:
2006.03.29 17:38:11 (Wed): The SMTP server does not like the name me@myhost.com.
Have you set the 'To:' field correctly, or do you need authorization (-u/-pw) ?
2



Very good question.... I will check this out! I'll post my answer on your question very soon!
TTB

(? ?.??.-> Admin @ Surfnet hubs <-.??.???)

bastya_elvtars

Well, you need only 2 extra options, username and password. And of course if username and password then params=params.." -u "..username.." "-p "..password end :P
Everything could have been anything else and it would have just as much meaning.

Psycho_Chihuahua

#4
i had already though of that

i've been trying to do that for a while now....all i came up with ist

function TestCreateBatch()
	local f = io.open("bmail.bat", "w")
	f:write("call hubbackup\\blat.exe -install "..cMailSMTP.." "..cFromMailAdress.." [-5 [- [- [-u [-pw ]]]]]\r\n"..
	"cd hubbackup\r\n"..
	"blat.exe cmail.txt -to "..cToMailAdress.." -f "..cFromMailAdress.." -s \"HubBackup "..os.date("%a %d %b %Y @ %H:%M").."\" -server "..cMailSMTP.." -debug -log mail.log -timestamp")
	if username and password then params=params.." -u "..username.." "-pw "..password
end
	f:close() 
	go = 10
end


which is of course - Wrong  ::)

i come up with this error
\HubBackup.v.1.lua:243: attempt to concatenate global `params' (a nil value)


bastya can you tell me where i went wrong ;)
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

bastya_elvtars

I don't know, this was just a generic thing. Haven't even seen the script. Would need to investigate whether blat can do encryption etc. and the way it accepts switches - I have no time for this right now.
Everything could have been anything else and it would have just as much meaning.

bastya_elvtars

No, the params I wroteare correct, just need to know how TTB uses them.
Everything could have been anything else and it would have just as much meaning.

Psycho_Chihuahua

PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Psycho_Chihuahua

#8
I think i got it working with Authentification now   :D

-- HubBackup v1.0 in LUA5
--------------------------------------------------------------------
-- Settings
--------------------------------------------------------------------
-- Admin // Only the ADMIN can call the commands! --
aAdmin = "Psycho_Chihuahua"

-- Main --
bot = frmHub:GetHubBotName()
bprefix = "#"
bcmd = "mailmyhub"
tcmd = "mailtest"
hcmd = "mailhelp"

-- Connection --
cMailSMTP = "mailserver"  -- Your SMTP adress, with standardport 25
cToMailAdress = "someone@somwhere.com"  -- Your backup mailadres
cFromMailAdress = "me@myhost.com"  -- Mailadress of the sender

-- Authentication --
AuthUser = "LoginUsername" -- Auth Username
AuthPass = "LoginPassword"  -- Auth Password

-- Backup automaticly --
dAutobackup = "w"  -- m = month // w = week // d = day // n = none
dTime = "3:30"  -- Time. Example:  3:30 ; 19:00.

--FOR YOUR INFORMATION:
-- 1. Monthly backups will be done on the 1st of every month!
-- 2. Weekly backups  will be done on every monday!

-- YOU ARE DONE NOW! Please run the script.

--------------------------------------------------------------------
-- Preloading
--------------------------------------------------------------------
function Main()
	Today = os.date("%d")
	frmHub:RegBot(bot)
	SendToOps(bot, "HubMailer is ready to go!")
	SetTimer(60000)  -- every minute check
	StartTimer()
end

--------------------------------------------------------------------
-- Timer
--------------------------------------------------------------------
function OnTimer()
	if os.date("%d")~= Today then
		Today = os.date("%d")
	end
	if dAutobackup == "m" then
		if os.date("%d - %H:%M") == ("27 - "..dTime) then
			SendToAll(bot, "Start creating backup... Sorry folks, we will have a little lag for a while!")
			HubMail()
		end		
	elseif dAutobackup == "w" then
		if os.date("%a - %H:%M") == ("Mon - "..dTime) then
			SendToAll(bot, "Start creating backup... Sorry folks, we will have a little lag for a while!")
			HubMail()
		end
	elseif dAutobackup == "d" then
		if os.date("%H:%M") == dTime then
			SendToAll(bot, "Start creating backup... Sorry folks, we will have a little lag for a while!")
			HubMail()
		end
	end
end

--------------------------------------------------------------------
-- ChatArrival for commands
--------------------------------------------------------------------
function ChatArrival(curUser,data)
	data = string.sub(data,1,string.len(data)-1)
	s,e,cmd = string.find(data,"%b<>%s+"..bprefix.."(%S+)")
	if cmd and (curUser.sName == aAdmin) then 
		if string.lower(cmd) == bcmd then
			HubMail(curUser)
			return 1
		elseif string.lower(cmd) == tcmd then
			TestMail(curUser)
			return 1
		elseif string.lower(cmd) == hcmd then
			HelpMail()
			return 1
		end
	end
end

function HubMail()
	Rarfile = "Hub.rar"
	SendPmToNick(aAdmin, bot,"Creating hubbackup...")
	SendPmToNick(aAdmin, bot,"Step 1: Creating cmail.txt in your hub folder -> It will be the text-content for your mail.")
	CreateInfoText()
	SendPmToNick(aAdmin, bot,"Step 1: Completed!")
	SendPmToNick(aAdmin, bot,"Step 2: Creating bmail.bat (batchfile) in your hub folder -> The batchfile can pack (with RAR) and send (with Blat) your hub.")
	CreateBatch()
	SendPmToNick(aAdmin, bot,"Step 2: Completed!")
	SendPmToNick(aAdmin, bot,"Step 3: Running the batchfile! -> YOUR HUB WILL NOW BE PACKED AND SEND BY MAIL!")
	RunBatch()
	SendPmToNick(aAdmin, bot,"Step 3: Completed!")
	SendPmToNick(aAdmin, bot,"Step 4: Showing logfile and delete all temp files -> cmail.txt, bmail.txt, hub.rar, mail.log")
	CallMailLog()
	DelInfoText()
end

function TestMail()
	SendPmToNick(aAdmin, bot,"Preparing testmail (text only, no attachments!) ...")
	SendPmToNick(aAdmin, bot,"Step 1: Creating cmail.txt in your hub folder -> It will be the text-content for your mail.")
	TestCreateInfoText()
	SendPmToNick(aAdmin, bot,"Step 1: Completed!")
	SendPmToNick(aAdmin, bot,"Step 2: Creating bmail.bat (batchfile) in your hub folder -> The batchfile can send (with Blat) your testmail.")
	TestCreateBatch()
	SendPmToNick(aAdmin, bot,"Step 2: Completed!")
	SendPmToNick(aAdmin, bot,"Step 3: Running the batchfile! -> TESTMAIL WILL BE SEND!")
	RunBatch()
	SendPmToNick(aAdmin, bot,"Step 3: Completed!")
	SendPmToNick(aAdmin, bot,"Step 4: Showing logfile and delete all temp files -> cmail.txt, bmail.txt, mail.log")
	CallMailLog(aAdmin)
	TestDelInfoText()
end

function HelpMail()
	if dAutobackup == "m" then
		dBackup = "Every month @ "..dTime..":00 on the 1st"
	elseif dAutobackup == "w" then
		dBackup = "Every week @ "..dTime..":00 on monday"
	elseif dAutobackup == "d" then
		dBackup = "Every day @ "..dTime..":00"
	elseif dAutobackup == "n" then
		dBackup = "None"
	end
	local HelpInfoForAdmin = ("\r\n\r\n"..
	"\t--<>--------------------------------------------------------------------------------------------------------------------------------------------------------<>--\r\n"..
	"\t\t\t [ MAIL Help ]\t\t\t [ MAIL Help ] \r\n"..
	"\t--<>--------------------------------------------------------------------------------------------------------------------------------------------------------<>--\r\n"..
	"\t\t"..bprefix..bcmd.."\t\t\t=\tSend hubbackup to mailadres\r\n"..
	"\t\t"..bprefix..tcmd.."\t\t\t\t=\tSend testmail to mailadres\r\n"..
	"\t\t"..bprefix..hcmd.."\t\t\t\t=\tThis menu\r\n"..
	"\t--<>--------------------------------------------------------------------------------------------------------------------------------------------------------<>--\r\n"..
	"\t\tYour current settings:\r\n"..
	"\t\tSMTP server\t\t\t=\t"..cMailSMTP.."\r\n"..
	"\t\tBackup mail (receive adress)\t\t=\t"..cToMailAdress.."\r\n"..
	"\t\tSend mail (sender)\t\t\t=\t"..cFromMailAdress.."\r\n"..
	"\t\tAutomaticly backup\t\t=\t"..dBackup.."\r\n"..
	"\t--<>--------------------------------------------------------------------------------------------------------------------------------------------------------<>--\r\n")
	SendToNick(aAdmin,HelpInfoForAdmin)	
end

--------------------------------------------------------------------
-- Creating DOS-files // execute DOS-files (CMD)
--------------------------------------------------------------------
function CreateInfoText()
	local f = io.open("hubbackup\\cmail.txt", "w") 
	f:write("HubBackup has created a backup for you!\r\n\r\nCreated on: "..os.date("%a %d %b %Y @ %H:%M").."\r\nAttachment: "..Rarfile.."\r\n\r\nHubBackup by TTB.")
	f:close()
end

function CreateBatch()
	local f = io.open("bmail.bat", "w")
	f:write("call hubbackup\\rar.exe a -r -y "..Rarfile.." ..\\*.*\r\n"..
	"copy "..Rarfile.." hubbackup\r\n"..
	"del "..Rarfile.."\r\n"..
	"call hubbackup\\blat.exe -install "..cMailSMTP.." "..cFromMailAdress.." [-5 [- [- ["..AuthUser.." ["..AuthPass.." ]]]]]\r\n"..
	"cd hubbackup\r\n"..
	"blat.exe cmail.txt -to "..cToMailAdress.." -f "..cFromMailAdress.." -u "..AuthUser.." -pw "..AuthPass.." -s \"HubBackup "..os.date("%a %d %b %Y @ %H:%M").."\" -server "..cMailSMTP.." -debug -log mail.log -timestamp -attach "..Rarfile)
	f:close()
end

function RunBatch()
	os.execute("bmail.bat")
end

function CallMailLog()
	local handle = io.input("hubbackup\\mail.log", "r")
	local info = nil
	local line = ""
	if handle then
		for line in handle:lines() do
			if info then
				info = info.."\r\n"..line
			else
				info = line
			end
		end
		if info == nil then
			SendPmToNick(aAdmin, bot,"Sorry, no log found")
		else
			SendPmToNick(aAdmin, bot,"**** Here is your log file:\r\n"..info.."\r\n")
		end
		handle:close()
	else
		SendPmToNick(aAdmin, bot,"Sorry, no log found")
	end
end

function DelInfoText()
	os.execute("del bmail.bat")
	os.execute("del hubbackup\\cmail.txt")
	os.execute("del hubbackup\\"..Rarfile)
	os.execute("del hubbackup\\mail.log")
end

function TestCreateInfoText()
	local f = io.open("hubbackup\\cmail.txt", "w") 
	f:write("HubBackup created a TESTMAIL for you!\r\n\r\nCreated on: "..os.date("%a %d %b %Y @ %H:%M").."\r\n\r\nHubBackup by TTB.")
	f:close()
end

function TestCreateBatch()
	local f = io.open("bmail.bat", "w")
	f:write("call hubbackup\\blat.exe -install "..cMailSMTP.." "..cFromMailAdress.." [-5 [- [- ["..AuthUser.." ["..AuthPass.." ]]]]]\r\n"..
	"cd hubbackup\r\n"..
	"blat.exe cmail.txt -to "..cToMailAdress.." -f "..cFromMailAdress.." -u "..AuthUser.." -pw "..AuthPass.." -s \"HubBackup "..os.date("%a %d %b %Y @ %H:%M").."\" -server "..cMailSMTP.." -debug -log mail.log -timestamp")
	f:close() 
	go = 10
end

function TestDelInfoText()
	os.execute("del bmail.bat")
	os.execute("del hubbackup\\cmail.txt")
	os.execute("del hubbackup\\mail.log")
end
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Psycho_Chihuahua

i got Auth working now and changed the script around a bit

New Stuff is:

- Settings now in settings.ini
- German and English Language Files
- Possible to turn User AUTH on or off
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Markitos

Quote from: Psycho_Chihuahua on 23 April, 2006, 12:29:29
i got Auth working now and changed the script around a bit

New Stuff is:

- Settings now in settings.ini
- German and English Language Files
- Possible to turn User AUTH on or off

-- Optimized a little
-- Made Lua5/5.1 compatible
-- Added OnError function
-- Bla Bla Bla... ;D

Psycho_Chihuahua

PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000


Psycho_Chihuahua

i spoke too soon  :(

it fucks up the profile reading from the Hub - i'm still searching for the bug at the moment  :'(

Even as a Master in my Hub i kept on getting

*** Error: You are not allowed to use this command!

from Profile based scripts

and as soon as i deactivated you version 1.3 everything was working again as they were supposed to
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Markitos

Quote from: Psycho_Chihuahua on 02 May, 2006, 18:13:28
i spoke too soon  :(

it fucks up the profile reading from the Hub - i'm still searching for the bug at the moment  :'(

Even as a Master in my Hub i kept on getting

*** Error: You are not allowed to use this command!

from Profile based scripts

and as soon as i deactivated you version 1.3 everything was working again as they were supposed to
Could u give me the 1.3 ver. I formatted my hdd  ;D

Psycho_Chihuahua

PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Markitos

#16
Quote from: Psycho_Chihuahua on 02 May, 2006, 19:09:37
Here's the Bugger  ;D
HubBackup created a TESTMAIL for you!

Created on: Tue 02 May 2006 @ 22:16

HubBackup by TTB.

Everyhing works fine here... right click, etc...i revised the code an saw nothing wrong.
Edit--//
And now...
HubBackup has created a backup for you!

Created on: Tue 02 May 2006 @ 22:17
Attachment: Hub.rar

HubBackup by TTB.

Psycho_Chihuahua

#17
Quote from: Psycho_Chihuahua on 02 May, 2006, 18:13:28
i spoke too soon  :(

it fucks up the profile reading from the Hub - i'm still searching for the bug at the moment  :'(

Even as a Master in my Hub i kept on getting

*** Error: You are not allowed to use this command!

from Profile based scripts

and as soon as i deactivated you version 1.3 everything was working again as they were supposed to

i didn't say it doesnt work....i said it interfears with other profile based scripts like google bot or mutors getprofiles script as well as other scripts that are set on Profile basis.
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Markitos

Quote from: Psycho_Chihuahua on 02 May, 2006, 21:47:10
Quote from: Psycho_Chihuahua on 02 May, 2006, 18:13:28
i spoke too soon  :(

it fucks up the profile reading from the Hub - i'm still searching for the bug at the moment  :'(

Even as a Master in my Hub i kept on getting

*** Error: You are not allowed to use this command!

from Profile based scripts

and as soon as i deactivated you version 1.3 everything was working again as they were supposed to

i didn't say it doesnt work....i said it interfears with other profile based scripts like google bot or mutors getprofiles script as well as other scripts that are set on Profile basis.
So...what do you purpose?

TrIp-iN-SuN

2006.05.04 00:42:27 (Thu)------------Start of Session-----------------
Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)
2006.05.04 00:42:27 (Thu): Error: Can't resolve hostname (tripsun1@walla.com).
2006.05.04 00:42:27 (Thu)-------------End of Session------------------


--------------------------------------------------------------------
-- Settings
--------------------------------------------------------------------
-- Admin // Only the ADMIN can call the commands! --
aAdmin = "']['rIp?iN??uN"

-- Main --
bot = frmHub:GetHubBotName()
bcmd = "mailmyhub"
tcmd = "mailtest"
hcmd = "mailhelp"

-- Connection --
cMailSMTP = "tripsun1@walla.com"  -- Your SMTP adress, with standardport 25
cToMailAdress = "tripsun1@walla.com"  -- Your backup mailadres
cFromMailAdress = "tripsun1@walla.com"  -- Mailadress of the sender

-- Authentication --
AuthStatus = "on"
AuthUser = "?uN"
AuthPass = "1111"

-- Backup automaticly --
dAutobackup = "w"  -- m = month // w = week // d = day // n = none
dTime = "3:30"  -- Time. Example:  3:30 ; 19:00.

LangFile = "Eng" -- for German inser Ger - otherwise the script is in english

y it's not work?

Psycho_Chihuahua

because this
cMailSMTP = "tripsun1@walla.com"  -- Your SMTP adress, with standardport 25

is an email adress and not a mailserver  ::)

try smtp.walla.com or mail.walla.com or something like that
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

TrIp-iN-SuN

and what is mailserver what i can use for this?

TrIp-iN-SuN

ohh ok tnx  i check this now  ;D

TrIp-iN-SuN

2006.05.04 00:52:57 (Thu)------------Start of Session-----------------
Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)
2006.05.04 00:53:18 (Thu): Error: Can't connect to server (timed out if winsock.dll error 10060)
2006.05.04 00:53:18 (Thu)-------------End of Session------------------

now i get this

bastya_elvtars

Quote from: TrIp-iN-SuN on 03 May, 2006, 22:53:20
2006.05.04 00:52:57 (Thu)------------Start of Session-----------------
Blat v2.5.0 w/GSS encryption (build : Sep 14 2005 22:46:29)
2006.05.04 00:53:18 (Thu): Error: Can't connect to server (timed out if winsock.dll error 10060)
2006.05.04 00:53:18 (Thu)-------------End of Session------------------

now i get this

Please RTFM before using a tool. :-)
Everything could have been anything else and it would have just as much meaning.

SMF spam blocked by CleanTalk