主頁 >  其他 > django框架 之sass專案中用到的工具 (1)

django框架 之sass專案中用到的工具 (1)

2021-09-03 18:42:59 其他

文章目錄

  • 前言
  • 一、ModelForm美化
    • 1.自定義radio標簽樣式
    • 2.自定義select標簽樣式
  • 三、django離線腳本
  • 四、pillow生成驗證碼

前言

sass專案視頻地址:https://www.bilibili.com/video/BV1uA411b77M

搭建虛擬環境鏈接:https://blog.csdn.net/weixin_45859193/article/details/115408555

采用django3.2.6版本,以untitled7為根目錄創建的專案名為web,在web專案中的view.py撰寫所有視圖,templates檔案存放模板標記語言、script存放腳本測驗,資料庫采用sqlite3, ModelForm美化標簽相關操作在form檔案中,static存放第三方庫及靜態檔案

urls.py如下:

from django.conf.urls import url, include

urlpatterns = [
    url(r"^web/", include("web.urls"))
]

web/urls.py如下:

from django.conf.urls import url
from web import views

urlpatterns = [
	# ModelForm美化相關
    url(r'register/', views.register, name="register"),
    url(r'radio/', views.radio, name="radio"),
    # 圖片驗證碼相關
    url(r'login/', views.login, name="login"),
    url(r'image_code/', views.image_code, name="image_code"),
]

一、ModelForm美化

概述:搭配通過django中自行通過ModelForm渲染標簽時使用bootstrap樣式,

示例:創建一個用戶表結構示例,

models.py如下:

class UserInfo(models.Model):
    username = models.CharField(verbose_name="用戶名", max_length=32)
    email = models.EmailField(verbose_name="郵箱", max_length=32)
    phone = models.CharField(verbose_name="手機號", max_length=32)
    password = models.CharField(verbose_name="密碼", max_length=32)

通過sqllite3創建控制臺輸入:

python manage.py makemigrations
python manage.py migrate

BootStrapForm類(重寫django渲染標簽樣式)如下:

class BootStrapForm(object):
    bootstrap_class_exclude = []

    # 初始化方法
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        # 每個欄位的欄位名和欄位值
        for name, field in self.fields.items():
            if name in self.bootstrap_class_exclude:
                continue
            old_class = field.widget.attrs.get('class', "")
            field.widget.attrs['class'] = '{} form-control'.format(old_class)
            field.widget.attrs['placeholder'] = '請輸入{}'.format(field.label)

視圖函式如下:

from django.shortcuts import render
from django.core.validators import RegexValidator
from django import forms
from web import models
from web.form.bootstarp import BootStrapForm


class RegisterModelForm(BootStrapForm, forms.ModelForm):
	# 這里如果想排除某個欄位可以使用 bootstrap_class_exclude = [欄位]
	bootstrap_class_exclude = []
    # 重寫欄位規則
    phone = forms.CharField(label="手機號", validators=[RegexValidator(r'^(1[3|5|6|8]\d{9}$)', "手機號格式錯誤")])
    password = forms.CharField(label="密碼", widget=forms.PasswordInput())
    code = forms.CharField(label="驗證碼")

    class Meta:
        model = models.UserInfo
        fields = "__all__"


def register(request):
    form = RegisterModelForm()
    return render(request, "register.html", {"form": form})

html模板如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
</head>
<style>
    .account {
        width: 600px;
        margin: 0 auto;
    }
</style>
<body>
<div class="account">
    <h1>注冊</h1>
    {% for field in form %}
        {% if field.name == 'code' %}
            <div class="form-group">
                <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                <div style="display: flex;justify-content: space-between;flex-direction: row-reverse">
                    <div class="col-xs-5">
                        <input id="btnSms" class="btn btn-info" type="button" value="獲取驗證碼">
                    </div>
                    <div class="col-xs-5">
                        {{ field }}
                        <span class="error-msg"></span>
                    </div>
                </div>
            </div>
        {% else %}
           <div class="form-group">
            <label for="{{ field.id_for_label }}">{{ field.label }}</label>
            {{ field }}
           <span class="error-msg"></span>
        </div>
        {% endif %}
    {% endfor %}
    <button type="button" class="btn btn-info">登錄</button>
</div>
</body>
</html>

此時訪問路由如下:

在這里插入圖片描述

概述:對于標簽而言是通過django.widgets.forms中通過模板標記語言渲染出來的,但是如果我們想用自己的也可以通過重寫的方式修改標簽樣式,這里拿select、radio標簽來展示,

為了方便展示我們創建一個專案表,

models.py如下:

class Project(models.Model):
    COLOR_CHOICES = (
        (1, '#56b8eb'),
        (2, '#f28033'),
        (3, '#ebc656'),
        (4, '#a2d148'),
        (5, '#20BFA4'),
        (6, '#7461c2'),
        (7, '#20bfa3'),
    )
    name = models.CharField(verbose_name='專案名', max_length=32)
    color = models.SmallIntegerField(verbose_name='顏色', choices=COLOR_CHOICES, default=1)
    desc = models.CharField(verbose_name='專案描述', max_length=255, null=True, blank=True)
    priority_choices = (
        ("danger", "高"),
        ("warning", "中"),
        ("success", "低"),
    )
    priority = models.CharField(verbose_name='優先級', max_length=12, choices=priority_choices, default='danger')

通過sqllite3創建控制臺輸入:

python manage.py makemigrations
python manage.py migrate

1.自定義radio標簽樣式

進入django.forms生成的函式RadioSelect原始碼:

class RadioSelect(ChoiceWidget):
    input_type = 'radio'
    template_name = 'django/forms/widgets/radio.html'
    option_template_name = 'django/forms/widgets/radio_option.html'

模板指向django中template檔案夾下的html,

我們先查看radio.html如下:

{% include "django/forms/widgets/multiple_input.html" %}

multiple_input.html如下:

{% with id=widget.attrs.id %}<ul{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}>{% for group, options, index in widget.optgroups %}{% if group %}
  <li>{{ group }}<ul{% if id %} id="{{ id }}_{{ index }}"{% endif %}>{% endif %}{% for option in options %}
    <li>{% include option.template_name with widget=option %}</li>{% endfor %}{% if group %}
  </ul></li>{% endif %}{% endfor %}
</ul>{% endwith %}

這些都是django的模板標記語言,大概就是通過widget來生成ul和li標簽,如果我們要修改可以根據以上模板標記語言修改,

radio_option.html如下:

{% include "django/forms/widgets/input_option.html" %}

input_option.html如下:

{% if widget.wrap_label %}<label{% if widget.attrs.id %} for="{{ widget.attrs.id }}"{% endif %}>{% endif %}{% include "django/forms/widgets/input.html" %}{% if widget.wrap_label %} {{ widget.label }}</label>{% endif %}

大致就是這樣,我們現在開始重寫,

創建widgets.py如下:

from django.forms import RadioSelect


class ColorRadioSelect(RadioSelect):
    # template_name = 'django/forms/widgets/radio.html'
    # option_template_name = 'django/forms/widgets/radio_option.html'
    template_name = 'widgets/color_radio/radio.html'
    option_template_name = 'widgets/color_radio/radio_option.html'

此時在該專案中的template創建widgets/color_radio檔案夾下的兩個radio.html、radio_option.html用于重寫,

radio.html如下:

{% with id=widget.attrs.id %}
    <div{% if id %} id="{{ id }}"{% endif %}{% if widget.attrs.class %} class="{{ widget.attrs.class }}"{% endif %}>
        {% for group, options, index in widget.optgroups %}
            {% for option in options %}
                <label {% if option.attrs.id %} for="{{ option.attrs.id }}"{% endif %} >
                    {% include option.template_name with widget=option %}
                </label>
            {% endfor %}
        {% endfor %}
    </div>
{% endwith %}

這里將ul和li標簽改成了div和label 標簽,

radio_option.html如下:

{% include "django/forms/widgets/input.html" %}
<span class="cycle" style="background-color:{{ option.label }}"></span>

這里沒有進行修改,只是在原基礎上增加了一個span標簽,

自此radio的重寫完成,那么現在開始寫表單和視圖,

結合上面的ModelForm表單美化(BootStrapForm函式:通過bootstarp的樣式美化標簽),

project.py如下:

from django import forms
from web.form.bootstarp import BootStrapForm
from web import models
from .widgets import ColorRadioSelect


class ProjectModelForm(BootStrapForm, forms.ModelForm):
    bootstrap_class_exclude = ['color']

    def __init__(self, request, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.request = request

    class Meta:
        model = models.Project
        fields = ["name","color","desc"]
        widgets = {
            'desc': forms.Textarea,
            'color': ColorRadioSelect(attrs={'class': 'color-radio'}),
        }

通過init函式可以看到,該函式也支持傳入request引數,并且這里排除了color(即radio標簽,我們用自己的方式),

view.py如下:

from web.form.project import ProjectModelForm
def radio(request):
    form = ProjectModelForm(request)
    return render(request, "radio.html", {"form": form})

radio.html如下:

{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{% static 'plugin/bootstrap-3.3.7-dist/css/bootstrap.min.css' %} ">
</head>
<style>
     .account {
        width: 600px;
        margin: 0 auto;
    }
    .color-radio label {
            margin-left: 0;
            padding-left: 0;
        }

        .color-radio input[type="radio"] {
            display: none;
        }

        .color-radio input[type="radio"] + .cycle {
            display: inline-block;
            height: 25px;
            width: 25px;
            border-radius: 50%;
            border: 2px solid #dddddd;
        }

        .color-radio input[type="radio"]:checked + .cycle {
            border: 2px solid black;
        }
</style>
<body>
    <div class="account">
        {% for field in form %}
            <div class="form-group">
                <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                {{ field }}
               <span class="error-msg"></span>
            </div>
        {% endfor %}
    </div>
</body>
</html>

此時訪問重寫radio的路由如下:
在這里插入圖片描述

2.自定義select標簽樣式

對于select標簽而言,我們不能通過樣式的形式去修改,所以需要其他庫bootstrap-select、font-awesome圖示庫、jquery,

下載這些庫的鏈接:https://gitee.com/miaojiaxi/s25day01/tree/master/web/static/

bootstrap-select官網:https://www.bootstrapselect.cn/

全部安裝完成后,我們進入django.forms生成的標簽函式Select查看美化select標簽的原始碼:

class Select(ChoiceWidget):
    input_type = 'select'
    template_name = 'django/forms/widgets/select.html'
    option_template_name = 'django/forms/widgets/select_option.html'
    add_id_index = False
    checked_attribute = {'selected': True}
    option_inherits_attrs = False

因為和radio一樣,且內部select.html不用重寫,只用將select中的option標簽,所以我們只用重寫option_template_name即可,那么我們先查看一下原始碼select_option.html如下:

<option value="{{ widget.value|stringformat:'s' }}"{% include "django/forms/widgets/attrs.html" %}>{{ widget.label }}</option>

在widgets/color_radio檔案夾下創建select.html用于重寫select_option.html如下:

<option value="{{ widget.value|stringformat:'s' }}" data-content="<i class='fa fa-circle text-{{ widget.value|stringformat:'s' }}'></i> {{ widget.label }}"
    {% include "django/forms/widgets/attrs.html" %}>
</option>

通過bootstrap-select庫的幫助用data-content = “標簽(font-awesome圖示庫)”,實作了添加圖示,而圖示樣式則為資料庫中表欄位,

修改一下之前的widgets.pt如下:

from django.forms import RadioSelect, Select


class ColorRadioSelect(RadioSelect):
    # template_name = 'django/forms/widgets/radio.html'
    # option_template_name = 'django/forms/widgets/radio_option.html'
    template_name = 'widgets/color_radio/radio.html'
    option_template_name = 'widgets/color_radio/radio_option.html'


class ColorSelect(Select):
    option_template_name = 'widgets/color_radio/select.html'

然后在修改project.py如下:

from django import forms
from web.form.bootstarp import BootStrapForm
from web import models
from .widgets import ColorRadioSelect, ColorSelect


class ProjectModelForm(BootStrapForm, forms.ModelForm):
	# 排除color資料庫的標簽美化
    bootstrap_class_exclude = ['color']

    def __init__(self, request, *args, **kwargs):
        super().__init__(*args, **kwargs)
        # ModelForm可以通過重寫傳request引數
        self.request = request

    class Meta:
        model = models.Project
        fields = "__all__"
        widgets = {
            'desc': forms.Textarea,
             # 自定義radio標簽美化
            'color': ColorRadioSelect(attrs={'class': 'color-radio'}),
             # 自定義select標簽美化
            "priority": ColorSelect(attrs={'class': 'selectpicker', "data-live-search": "true"}),
        }

最后將我們用到的庫匯入即可,

radio.html如下:

{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="{% static 'plugin/bootstrap-3.3.7-dist/css/bootstrap.min.css' %} ">
    <script src="{% static 'js/jquery-3.5.1.js' %}"></script>
    <script src="{% static 'plugin/bootstrap-3.3.7-dist/js/bootstrap.min.js' %}"></script>
    <script src="{% static 'plugin/bootstrap-select/js/bootstrap-select.min.js' %}"></script>
    <link rel="stylesheet" href="{% static 'plugin/font-awesome-4.7.0/css/font-awesome.min.css' %}">
    <link rel="stylesheet" href="{% static 'plugin/bootstrap-select/css/bootstrap-select.min.css' %}">
</head>
<style>
     .account {
        width: 600px;
        margin: 0 auto;
    }
    .color-radio label {
            margin-left: 0;
            padding-left: 0;
        }

        .color-radio input[type="radio"] {
            display: none;
        }

        .color-radio input[type="radio"] + .cycle {
            display: inline-block;
            height: 25px;
            width: 25px;
            border-radius: 50%;
            border: 2px solid #dddddd;
        }

        .color-radio input[type="radio"]:checked + .cycle {
            border: 2px solid black;
        }
</style>
<body>
    <div class="account">
        {% for field in form %}
            <div class="form-group">
                <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                {{ field }}
               <span class="error-msg"></span>
            </div>
        {% endfor %}
    </div>
</body>
</html>

此時訪問路由如下:

在這里插入圖片描述

三、django離線腳本

概述:通過在django沒有啟動的情況下去執行某些操作,一般多用于爬蟲或其他需要離線呼叫操作,

示例:創建一個init_test.py測驗redis的連接,

import os
import sys
import django

base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "untitled7.settings")

django.setup()
# 注意這里匯入庫必須等django啟動了才行
import redis

# 直接連接redis
conn = redis.Redis(host='127.0.0.1', port=6379, password='密碼', encoding='utf-8')
# 設定鍵值:15131255089="9999" 且超時時間為10秒(值寫入到redis時會自動轉字串)
conn.set('15131255089', 9999, ex=10)
# 根據鍵獲取值:如果存在獲取值(獲取到的是位元組型別);不存在則回傳None
value = conn.get('15131255089')
print(value)

列印

b'9999'

四、pillow生成驗證碼

概述:用于檢查用戶是否為機器人而生成的驗證碼識別,

示例:創建image_code.py結合表單驗證實作用戶登錄驗證碼點擊切換,

Monaco.ttf字體(放到專案的根目錄下)訪問:https://gitee.com/miaojiaxi/s25day01/tree/master/utils

安裝pillow

pip3 install pillow

image_code.py如下:

import random
from PIL import Image, ImageDraw, ImageFont, ImageFilter


def check_code(width=120, height=30, char_length=5, font_file='Monaco.ttf', font_size=28):
    code = []
    img = Image.new(mode='RGB', size=(width, height), color=(255, 255, 255))
    draw = ImageDraw.Draw(img, mode='RGB')

    def rndChar():
        """
        生成隨機字母
        :return:
        """
        return chr(random.randint(65, 90))

    def rndColor():
        """
        生成隨機顏色
        :return:
        """
        return (random.randint(0, 255), random.randint(10, 255), random.randint(64, 255))

    # 寫文字
    font = ImageFont.truetype(font_file, font_size)
    for i in range(char_length):
        char = rndChar()
        code.append(char)
        h = random.randint(0, 4)
        draw.text([i * width / char_length, h], char, font=font, fill=rndColor())

    # 寫干擾點
    for i in range(40):
        draw.point([random.randint(0, width), random.randint(0, height)], fill=rndColor())

    # 寫干擾圓圈
    for i in range(40):
        draw.point([random.randint(0, width), random.randint(0, height)], fill=rndColor())
        x = random.randint(0, width)
        y = random.randint(0, height)
        draw.arc((x, y, x + 4, y + 4), 0, 90, fill=rndColor())

    # 畫干擾線
    for i in range(5):
        x1 = random.randint(0, width)
        y1 = random.randint(0, height)
        x2 = random.randint(0, width)
        y2 = random.randint(0, height)

        draw.line((x1, y1, x2, y2), fill=rndColor())

    img = img.filter(ImageFilter.EDGE_ENHANCE_MORE)
    return img, ''.join(code)


if __name__ == '__main__':
    image_object, code = check_code()
    print(code)
    with open('code.png', 'wb') as f:
        image_object.save(f, format='png')

生成驗證碼視圖函式如下:

def image_code(request):
    image_object, code = check_code()
    # 通過session保存驗證碼進行驗證
    request.session['image_code'] = code
    # 超時時間
    request.session.set_expiry(60)

    # 保存在記憶體中
    stream = BytesIO()
    image_object.save(stream, 'png')

    return HttpResponse(stream.getvalue())

用戶登錄(login)視圖函式如下:

class LoginForm(BootStrapForm, forms.ModelForm):
    username = forms.CharField(label="用戶名")
    password = forms.CharField(label="密碼", widget=forms.PasswordInput())
    code = forms.CharField(label="圖片驗證碼")

    class Meta:
        model = models.UserInfo
        fields = ["username", "password", "code"]


def login(request):
    form = LoginForm()
    return render(request, "login.html", {"form": form})

用戶渲染標簽login.html如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
</head>
<style>
    .account {
        width: 600px;
        margin: 0 auto;
    }
</style>
<body>
<div class="account">
    <form action="{% url 'login' %}" method="post" novalidate>
        {% csrf_token %}
        {% for field in form %}
            {% if field.name == 'code' %}
                <div class="form-group">
                    <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                    <div style="display: flex;justify-content: space-between">
                        <div class="col-xs-7">
                            {{ field }}
                        </div>
                        <div class="col-xs-5">
                            <img src="{% url 'image_code' %}" id="imageCode" title="點擊更換圖片">
                        </div>
                    </div>
                </div>
            {% else %}
                <div class="form-group">
                    <label for="{{ field.id_for_label }}">{{ field.label }}</label>
                    {{ field }}
                </div>
            {% endif %}
        {% endfor %}
        <div class="form-group">
            <input id="btnSubmit" type="submit" class="btn btn-primary" value="登 錄">
        </div>


    </form>
</div>
</body>
<script>
    (() => {
        document.getElementById("imageCode").onclick = function () {
            // 找到str屬性
            var oldSrc = document.getElementById("imageCode")
            // 每次執行這個屬性加上一個?(相當于重繪)
            oldSrc.src += "?"
        }
    })()

</script>
</html>

此時訪問路由如下:
在這里插入圖片描述

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/297121.html

標籤:其他

上一篇:PostMan詳細介紹

下一篇:Charles的使用

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 網閘典型架構簡述

    網閘架構一般分為兩種:三主機的三系統架構網閘和雙主機的2+1架構網閘。 三主機架構分別為內端機、外端機和仲裁機。三機無論從軟體和硬體上均各自獨立。首先從硬體上來看,三機都用各自獨立的主板、記憶體及存盤設備。從軟體上來看,三機有各自獨立的作業系統。這樣能達到完全的三機獨立。對于“2+1”系統,“2”分為 ......

    uj5u.com 2020-09-10 02:00:44 more
  • 如何從xshell上傳檔案到centos linux虛擬機里

    如何從xshell上傳檔案到centos linux虛擬機里及:虛擬機CentOs下執行 yum -y install lrzsz命令,出現錯誤:鏡像無法找到軟體包 前言 一、安裝lrzsz步驟 二、上傳檔案 三、遇到的問題及解決方案 總結 前言 提示:其實很簡單,往虛擬機上安裝一個上傳檔案的工具 ......

    uj5u.com 2020-09-10 02:00:47 more
  • 一、SQLMAP入門

    一、SQLMAP入門 1、判斷是否存在注入 sqlmap.py -u 網址/id=1 id=1不可缺少。當注入點后面的引數大于兩個時。需要加雙引號, sqlmap.py -u "網址/id=1&uid=1" 2、判斷文本中的請求是否存在注入 從文本中加載http請求,SQLMAP可以從一個文本檔案中 ......

    uj5u.com 2020-09-10 02:00:50 more
  • Metasploit 簡單使用教程

    metasploit 簡單使用教程 浩先生, 2020-08-28 16:18:25 分類專欄: kail 網路安全 linux 文章標簽: linux資訊安全 編輯 著作權 metasploit 使用教程 前言 一、Metasploit是什么? 二、準備作業 三、具體步驟 前言 Msfconsole ......

    uj5u.com 2020-09-10 02:00:53 more
  • 游戲逆向之驅動層與用戶層通訊

    驅動層代碼: #pragma once #include <ntifs.h> #define add_code CTL_CODE(FILE_DEVICE_UNKNOWN,0x800,METHOD_BUFFERED,FILE_ANY_ACCESS) /* 更多游戲逆向視頻www.yxfzedu.com ......

    uj5u.com 2020-09-10 02:00:56 more
  • 北斗電力時鐘(北斗授時服務器)讓網路資料更精準

    北斗電力時鐘(北斗授時服務器)讓網路資料更精準 北斗電力時鐘(北斗授時服務器)讓網路資料更精準 京準電子科技官微——ahjzsz 近幾年,資訊技術的得了快速發展,互聯網在逐漸普及,其在人們生活和生產中都得到了廣泛應用,并且取得了不錯的應用效果。計算機網路資訊在電力系統中的應用,一方面使電力系統的運行 ......

    uj5u.com 2020-09-10 02:01:03 more
  • 【CTF】CTFHub 技能樹 彩蛋 writeup

    ?碎碎念 CTFHub:https://www.ctfhub.com/ 筆者入門CTF時時剛開始刷的是bugku的舊平臺,后來才有了CTFHub。 感覺不論是網頁UI設計,還是題目質量,賽事跟蹤,工具軟體都做得很不錯。 而且因為獨到的金幣制度的確讓人有一種想去刷題賺金幣的感覺。 個人還是非常喜歡這個 ......

    uj5u.com 2020-09-10 02:04:05 more
  • 02windows基礎操作

    我學到了一下幾點 Windows系統目錄結構與滲透的作用 常見Windows的服務詳解 Windows埠詳解 常用的Windows注冊表詳解 hacker DOS命令詳解(net user / type /md /rd/ dir /cd /net use copy、批處理 等) 利用dos命令制作 ......

    uj5u.com 2020-09-10 02:04:18 more
  • 03.Linux基礎操作

    我學到了以下幾點 01Linux系統介紹02系統安裝,密碼啊破解03Linux常用命令04LAMP 01LINUX windows: win03 8 12 16 19 配置不繁瑣 Linux:redhat,centos(紅帽社區版),Ubuntu server,suse unix:金融機構,證券,銀 ......

    uj5u.com 2020-09-10 02:04:30 more
  • 05HTML

    01HTML介紹 02頭部標簽講解03基礎標簽講解04表單標簽講解 HTML前段語言 js1.了解代碼2.根據代碼 懂得挖掘漏洞 (POST注入/XSS漏洞上傳)3.黑帽seo 白帽seo 客戶網站被黑帽植入劫持代碼如何處理4.熟悉html表單 <html><head><title>TDK標題,描述 ......

    uj5u.com 2020-09-10 02:04:36 more
最新发布
  • 2023年最新微信小程式抓包教程

    01 開門見山 隔一個月發一篇文章,不過分。 首先回顧一下《微信系結手機號資料庫被脫庫事件》,我也是第一時間得知了這個訊息,然后跟蹤了整件事情的經過。下面是這起事件的相關截圖以及近日流出的一萬條資料樣本: 個人認為這件事也沒什么,還不如關注一下之前45億快遞資料查詢渠道疑似在近日復活的訊息。 訊息是 ......

    uj5u.com 2023-04-20 08:48:24 more
  • web3 產品介紹:metamask 錢包 使用最多的瀏覽器插件錢包

    Metamask錢包是一種基于區塊鏈技術的數字貨幣錢包,它允許用戶在安全、便捷的環境下管理自己的加密資產。Metamask錢包是以太坊生態系統中最流行的錢包之一,它具有易于使用、安全性高和功能強大等優點。 本文將詳細介紹Metamask錢包的功能和使用方法。 一、 Metamask錢包的功能 數字資 ......

    uj5u.com 2023-04-20 08:47:46 more
  • vulnhub_Earth

    前言 靶機地址->>>vulnhub_Earth 攻擊機ip:192.168.20.121 靶機ip:192.168.20.122 參考文章 https://www.cnblogs.com/Jing-X/archive/2022/04/03/16097695.html https://www.cnb ......

    uj5u.com 2023-04-20 07:46:20 more
  • 從4k到42k,軟體測驗工程師的漲薪史,給我看哭了

    清明節一過,盲猜大家已經無心上班,在數著日子準備過五一,但一想到銀行卡里的余額……瞬間心情就不美麗了。最近,2023年高校畢業生就業調查顯示,本科畢業月平均起薪為5825元。調查一出,便有很多同學表示自己又被平均了。看著這一資料,不免讓人想到前不久中國青年報的一項調查:近六成大學生認為畢業10年內會 ......

    uj5u.com 2023-04-20 07:44:00 more
  • 最新版本 Stable Diffusion 開源 AI 繪畫工具之中文自動提詞篇

    🎈 標簽生成器 由于輸入正向提示詞 prompt 和反向提示詞 negative prompt 都是使用英文,所以對學習母語的我們非常不友好 使用網址:https://tinygeeker.github.io/p/ai-prompt-generator 這個網址是為了讓大家在使用 AI 繪畫的時候 ......

    uj5u.com 2023-04-20 07:43:36 more
  • 漫談前端自動化測驗演進之路及測驗工具分析

    隨著前端技術的不斷發展和應用程式的日益復雜,前端自動化測驗也在不斷演進。隨著 Web 應用程式變得越來越復雜,自動化測驗的需求也越來越高。如今,自動化測驗已經成為 Web 應用程式開發程序中不可或缺的一部分,它們可以幫助開發人員更快地發現和修復錯誤,提高應用程式的性能和可靠性。 ......

    uj5u.com 2023-04-20 07:43:16 more
  • CANN開發實踐:4個DVPP記憶體問題的典型案例解讀

    摘要:由于DVPP媒體資料處理功能對存放輸入、輸出資料的記憶體有更高的要求(例如,記憶體首地址128位元組對齊),因此需呼叫專用的記憶體申請介面,那么本期就分享幾個關于DVPP記憶體問題的典型案例,并給出原因分析及解決方法。 本文分享自華為云社區《FAQ_DVPP記憶體問題案例》,作者:昇騰CANN。 DVPP ......

    uj5u.com 2023-04-20 07:43:03 more
  • msf學習

    msf學習 以kali自帶的msf為例 一、msf核心模塊與功能 msf模塊都放在/usr/share/metasploit-framework/modules目錄下 1、auxiliary 輔助模塊,輔助滲透(埠掃描、登錄密碼爆破、漏洞驗證等) 2、encoders 編碼器模塊,主要包含各種編碼 ......

    uj5u.com 2023-04-20 07:42:59 more
  • Halcon軟體安裝與界面簡介

    1. 下載Halcon17版本到到本地 2. 雙擊安裝包后 3. 步驟如下 1.2 Halcon軟體安裝 界面分為四大塊 1. Halcon的五個助手 1) 影像采集助手:與相機連接,設定相機引數,采集影像 2) 標定助手:九點標定或是其它的標定,生成標定檔案及內參外參,可以將像素單位轉換為長度單位 ......

    uj5u.com 2023-04-20 07:42:17 more
  • 在MacOS下使用Unity3D開發游戲

    第一次發博客,先發一下我的游戲開發環境吧。 去年2月份買了一臺MacBookPro2021 M1pro(以下簡稱mbp),這一年來一直在用mbp開發游戲。我大致分享一下我的開發工具以及使用體驗。 1、Unity 官網鏈接: https://unity.cn/releases 我一般使用的Apple ......

    uj5u.com 2023-04-20 07:40:19 more