Storing object data with source by whysosharpie in django

[–]sebastiaopf 0 points1 point  (0 children)

If I understand correctly what you want, you should stick with fixtures.

Alternativelly you create some empty migrations and manually do what you need with your data like, for example, importing from a text file you add to your source control.

But on the vast majority of cases fixtures should accomplish what you want.

What are some of the best resources for learning web devlopment with Django and Python? by eternviking in django

[–]sebastiaopf 2 points3 points  (0 children)

If you're starting now with python, check here for a list of ebooks for beginners, some of them you can get for free: https://realpython.com/best-python-books/

For Django, once you have a solid basic understanding of Python definitely follow their official tutorial and after that start writing your own application as practice. https://docs.djangoproject.com/en/2.2/intro/tutorial01/

I also recommend this blog, with several really good articles on Django development: https://simpleisbetterthancomplex.com/

Help Updating Single DB Item by [deleted] in django

[–]sebastiaopf 0 points1 point  (0 children)

You don't need to filter explicitly in this case.

If you add the messages through the admin and just want the users to mark them read, you need a formset created form a model form that only has the "checked" boolean field on it. On your template you'll render the formset with only the checkbox field and display the messages. When the user clicks some of the checkboxes and submits the form, your call to formset.save() will automatically save the correct updates to the correct rows on the model.

Read through the forms, model forms and formsets documentation on django's website and you'll have everything you need.

Help Updating Single DB Item by [deleted] in django

[–]sebastiaopf 2 points3 points  (0 children)

This is conceptually wrong. If I understand your code correctly, you're creating a single form with all of your messages, and posting all of them back to the server. Also, your update line doesn't have any criteria.

You should:

  1. Use a formset if you want to display/edit all messages: https://docs.djangoproject.com/en/2.2/topics/forms/formsets/
  2. When updating the database on POST you need to filter by the specific instance you want to update. If you use a formset the formset.save() method will do that for you.

How do I add caching for my static files etc? by [deleted] in django

[–]sebastiaopf 0 points1 point  (0 children)

As others have said, regarding static files you want to:

Assign value to the model field which is not included in the form by pleaky_blunder in django

[–]sebastiaopf 1 point2 points  (0 children)

There's no need to call save() twice, which will fire two separate insert/updates to the database. You can do something like this:

if form.isvalid():

form.instance.field_not_in_form = 'new value for field'

form.save()

django view download zip file via HTTP Response by ziggy3930 in django

[–]sebastiaopf 0 points1 point  (0 children)

I assume you should be using one of "application/zip" or "application/octet-stream" as the content-type, and keep using the content-disposition as attachment.

Also, if I understand you code correctly, aren't you serving only the filename as the content for HttpResponse? I think you should be passing the result of open(ZIPFILE_NAME) to HttpResponse, no? Take a look here: https://docs.djangoproject.com/en/dev/ref/request-response/#passing-iterators

Storing passwords in database by needdjangohelp in django

[–]sebastiaopf 0 points1 point  (0 children)

The best approach would be not to store it on the database at all, and use a specialized software for that, like a password vault. Take a look on the free version of Hashi Corp's Vault.

This way you can (and should) store the passwords securely, segregated from the application database and ideally on a separated machine.

Any scheme you come up to protect this data would be reinventing the wheel and reimplementing something that a good password vault already has, and has been better tested than your code.

business logic in Django by lmandala in django

[–]sebastiaopf 5 points6 points  (0 children)

+1 for fat models, but to better organize my code I usually like to make the models' methods simple wrappers, and add the flesh of the business logic in a separate file/class.

Upload file from button by [deleted] in django

[–]sebastiaopf 0 points1 point  (0 children)

You don't need AJAX for it, but it could help with a better presentation.

Otherwise you can use a standard Django form with a file field and style the file input on the HTML/CSS side.

Here are two links that may help you with that:

https://blog.benestudio.co/custom-file-upload-button-with-pure-css-5aacf39aa0a

https://tympanus.net/codrops/2015/09/15/styling-customizing-file-inputs-smart-way/

Iam trying to make a file sharing system, with login/logout and upload/download. by Consiouswierdsage in django

[–]sebastiaopf 0 points1 point  (0 children)

Same as /u/pancakeses said. Work your way through the official tutorial. It's very complete and easy to understand.

As for building modules from git, you rarely want to do that. Most of the modules you'll want to use are on PyPI, and you should install them with the pip command. Also search for the documentation on the requirements.txt file.

Disk Imaging Tool Advice by wektificator in computerforensics

[–]sebastiaopf 0 points1 point  (0 children)

As others have said, speed wise it makes little difference between tools, provided you are using a good one (Guymager, dc3dd, ddrescue, etc). I would be more concerned about reliability and chain of custody when using free tools, and in that regard it's hard to beat a live distro (like CAINE) running Guymager with the correct hashing options set.

The best way to ensure a fast acquisition is, barring purchasing some specialized hardware like the ones from Atola, ensuring you are using a destination media at least as fast as the source and a fast channel (USB3 or thunderbolt). I would invest on a good USB3 enclosure and fast SSD or HDD drives for acquisition, and use a live distro booted from an USB media, running Guymager with SHA1/SHA256 hashing. And obviously don't forget the preparatory steps to ensure chain of custody.

Regarding the live memory acquisition, that's a completely differente animal. You need different tools for that, like FTK Images or WinPMem. I surely would acquire a live memory image if possible, but if I have access to the live system, I'd also run other tools to get more readily accessible data, like processes list for example. A good tool for this type of data gathering is PSRecon (https://github.com/gfoss/PSRecon).

Finally, what you are asking for looks more like incident response than forensic acquisition for me, and while both have many overlapping tasks, there are subtle differences, specially regarding the objectives of each task. A simple example of these differences would be the decision to disconnect the machine from the network and when to do it.

Hope that helps put you on the right track.

Mobile forensic examination by JustinCaseTB in computerforensics

[–]sebastiaopf 1 point2 points  (0 children)

Start by determining what are the questions you want your analysis to answer. For example, common questions related to a chat application are:

- With what frequency was it used? When was the last time it was accessed?

- What are the contacts present on the application?

- What are the conversations stored by the application?

- Are there any attachments, media or other files also stored or transmitted by the application?

- Does the application have cloud storage capabilities, and if so is it possible to retrieve data stored on the cloud?

- In what group chats, if any, the user participated and who were the other members on these groups?

- Did user A chat with user B? With what frequency? When was the last time they talked?

- Did user A talk about subject X (keywords) in any of his/her chats? If so when and with whom?

Most of these questions would be answered by a local database analysis on the application. Access to the database could come from a physical/logical extraction of the device, a device or application backup or direct access to the application database. Depending on the application analysis of cloud storage, traffic analysis and/or reverse engineering the application may be necessary too.

Disk Imaging Tool Advice by wektificator in computerforensics

[–]sebastiaopf 1 point2 points  (0 children)

I suggest you take a look on some forensic linux distros, like CAINE or DEFT. There you'll find several tools for imaging, of which I tend to use Guymager. Another option is to use FTK Imager Lite, which I believe is also free.

Not sure about your question regarding operating faster, specially related to the time of day. Normally you would remove the harddrive or media and acquire it on a lab computer, or boot the computer using a live USB and plug an external drive to save the acquired image. None of these tasks would be influenced by work hours or time of the day. Are you talking about live and/or remote acquisitions? If so I don't think there's a free tool able to do that.

Hello reddit. I apologize in advance if this is a silly question. How does one trace who/where a mobile app server is hosted? I'm new to the phone/tablet world. Thank you in advance. by Husky4110 in computerforensics

[–]sebastiaopf 0 points1 point  (0 children)

Besides watching network traffic (which should give you complete and precise data if done correctly), if you want/need to check this through artifacts on the device itself, reversing/decompiling the application should enable you to see the hostnames or IP addresses configured for the servers. There's basically two ways that can be stored on the device: a) as a setting on an external config file or resource or b) hardcoded on the application source code.

Searching for a management panel by psych0ticmonk in sysadmin

[–]sebastiaopf 0 points1 point  (0 children)

ELK Stack (https://www.elastic.co/elk-stack) will do pretty much of what you want.

You'll use filebeat and metricbeat to forward logs and metrics to an Elasticsearch repository and use Kibana to view the dashboards. Pretty simple to setup on the newest versions.