Difference between revisions of "TruxtonChildFileIO newurl"
Jump to navigation
Jump to search
(Created page with "This creates a new website visit record from a file in Truxton. It automatically associates the parent file and media identifiers used in the WebsiteVisit Table | URL table....") |
(→Sample) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
This creates a new website visit record from a file in Truxton. | This creates a new website visit record from a file in Truxton. | ||
| − | It automatically associates the parent file and media identifiers used in the [[WebsiteVisit Table | | + | It automatically associates the parent file and media identifiers used in the <code><nowiki>[</nowiki>[[WebsiteVisit Table|WebsiteVisit]]<nowiki>]</nowiki></code> table. |
=Syntax= | =Syntax= | ||
| − | < | + | <source lang="Python"> |
object newurl(); | object newurl(); | ||
| − | </ | + | </source> |
=Return value= | =Return value= | ||
| − | A Website Visit object | + | A [[TruxtonUrl|Website Visit]] object |
=Sample= | =Sample= | ||
| − | + | <source lang="Python" highlight="34"> | |
| − | < | ||
import truxton | import truxton | ||
import shutil | import shutil | ||
| Line 60: | Line 59: | ||
if __name__ == "__main__": | if __name__ == "__main__": | ||
| − | main() | + | sys.exit(main()) |
| − | </ | + | </source> |
Latest revision as of 10:06, 3 February 2024
This creates a new website visit record from a file in Truxton.
It automatically associates the parent file and media identifiers used in the [WebsiteVisit] table.
Syntax
object newurl();
Return value
A Website Visit object
Sample
import truxton
import shutil
from datetime import datetime
from calendar import timegm
from pathlib import Path
EPOCH_AS_FILETIME = 116444736000000000
HUNDREDS_OF_NANOSECONDS = 10000000
def date_to_filetime(dt):
return EPOCH_AS_FILETIME + (timegm(dt.timetuple()) * HUNDREDS_OF_NANOSECONDS)
def add_file(parent_truxton_file, filename):
source_file = open(filename, "rb")
child = parent_truxton_file.newchild()
child.name = Path(filename).name
shutil.copyfileobj(source_file, child)
source_file.close()
child.save()
return child
EPOCH_AS_FILETIME = 116444736000000000
HUNDREDS_OF_NANOSECONDS = 10000000
def date_to_filetime(dt):
return EPOCH_AS_FILETIME + (timegm(dt.timetuple()) * HUNDREDS_OF_NANOSECONDS)
def main():
t = truxton.create()
file = t.getfileid("5ec2a123-74d6-5da7-0653-4e6800000000")
child = add_child( file, "C:/Manual Exploitation/URLs.csv")
url = child.newurl()
url.account = "JimBillyRayJoeBob"
url.format = truxton.URL_FORMAT_ASCII
url.method = truxton.URL_METHOD_TYPE_USER_TYPED_IT_IN
url.type = truxton.URL_TYPE_FIREFOX
url.offset = 16384
url.when = date_to_filetime(datetime.utcnow())
url.url = "https://www.truxwiki.com"
if url.save() is True:
print( "New URL saved as " + url.id )
if __name__ == "__main__":
sys.exit(main())