热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Android-拉动SQlite数据库安卓设备-Android-PullingSQlitedatabaseandroiddevice

Ivelookedeverywhereandicantfindarealpreciseansweroratutorialonhow,ifitispossibl

I've looked everywhere and i can't find a real precise answer or a tutorial on how, if it is possible, to do this.

我到处寻找,我找不到真正准确的答案或教程,如果可能的话,如何做到这一点。

is it possible to pull in any way a database of an Android device without having to root it? i just need to extract that data in any way in order to gather it on my pc, so how can i perform this? do i have to reprogram the app or whatever method you guys know about, but remember without rooting the device. thanks

是否可以以任何方式提取Android设备的数据库而无需root用户?我只需要以任何方式提取数据,以便将其收集到我的电脑上,那么我该如何执行此操作呢?我是否需要重新编程应用程序或您知道的任何方法,但请记住,不要使用设备。谢谢

20 个解决方案

#1


75  

A common way to achieve what you desire is to use the ADB pull command.

实现所需的常用方法是使用ADB pull命令。

Another way I prefer in most cases is to copy the database by code to SD card:

在大多数情况下,我更喜欢的另一种方法是通过代码将数据库复制到SD卡:

try {
    File sd = Environment.getExternalStorageDirectory();

    if (sd.canWrite()) {
        String currentDBPath = "/data/data/" + getPackageName() + "/databases/yourdatabasename";
        String backupDBPath = "backupname.db";
        File currentDB = new File(currentDBPath);
        File backupDB = new File(sd, backupDBPath);

        if (currentDB.exists()) {
            FileChannel src = new FileInputStream(currentDB).getChannel();
            FileChannel dst = new FileOutputStream(backupDB).getChannel();
            dst.transferFrom(src, 0, src.size());
            src.close();
            dst.close();
        }
    }
} catch (Exception e) {

}

Don't forget to set the permission to write on SD in your manifest, like below.

不要忘记在清单中设置写入SD的权限,如下所示。


#2


175  

If your device is running Android v4 or above, you can pull app data, including it's database, without root by using adb backup command, then extract the backup file and access the sqlite database.

如果您的设备运行的是Android v4或更高版本,则可以使用adb backup命令在没有root的情况下提取应用程序数据(包括数据库),然后提取备份文件并访问sqlite数据库。

First backup app data to your PC via USB cable with the following command, replace app.package.name with the actual package name of the application.

首先使用以下命令通过USB电缆将应用程序数据备份到PC,将app.package.name替换为应用程序的实际软件包名称。

adb backup -f ~/data.ab -noapk app.package.name

This will prompt you to "unlock your device and confirm the backup operation". Do not provide a password for backup encryption, so you can extract it later. Click on the "Back up my data" button on your device. The screen will display the name of the package you're backing up, then close by itself upon successful completion.

这将提示您“解锁设备并确认备份操作”。不提供备份加密的密码,因此您可以稍后解压缩。单击设备上的“备份我的数据”按钮。屏幕将显示您要备份的软件包的名称,然后在成功完成后自行关闭。

The resulting data.ab file in your home folder contains application data in android backup format. To extract it use the following command:

主文件夹中生成的data.ab文件包含android备份格式的应用程序数据。要提取它,请使用以下命令:

dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf -

If the above ended with openssl:Error: 'zlib' is an invalid command. error, try the below.

如果上面以openssl结束:错误:'zlib'是无效命令。错误,请尝试以下。

dd if=data.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -

The result is the apps/app.package.name/ folder containing application data, including sqlite database.

结果是包含应用程序数据的apps / app.package.name /文件夹,包括sqlite数据库。

For more details you can check the original blog post.

有关详细信息,请查看原始博文。

#3


67  

For debuggable apps1 on non-rooted devices, you could use following command:

对于非root设备上的可调试apps1,您可以使用以下命令:

adb shell run-as package.name chmod 666 /data/data/package.name/databases/file
adb pull /data/data/package.name/databases/file

Example:

例:

adb shell run-as com.app chmod 666 /data/data/com.app/databases/data.db
adb pull /data/data/com.app/databases/data.db

Set PATH adb for Enviroment Variables or use cd command to android sdk folder platform-tools.

为环境变量设置PATH adb或使用cd命令到android sdk文件夹platform-tools。

Example:

例:

cd /folder/android-sdk/platform-tools/

then use above command

然后使用上面的命令


1 Note that most apps in Play store are not debuggable since it requires setting the debuggable flag in the manifest.

1请注意,Play商店中的大多数应用程序都不可调试,因为它需要在清单中设置debuggable标志。

#4


50  

Most of the answers here are way more complicated than they have to be. If you just want to copy the database of your app from your phone to your computer then you just need this command:

这里的大部分答案都比以前更加复杂。如果您只想将应用程序的数据库从手机复制到计算机,那么您只需要以下命令:

adb -d shell "run-as your.package.name cat databases/database.name" > target.sqlite

All you need to fill in in the above command is the package name of your app, what the database is called and optionally what/where you want the database to be copied to.

您需要在上面的命令中填写的只是您的应用程序的包名称,数据库的调用内容以及您希望将数据库复制到的位置/位置。

Please note that this specific command will only work if you have only one device connected to your computer. The -d parameter means that the only connected device will be targeted. But there are other parameters which you can use instead:

请注意,只有当您的计算机只连接了一台设备时,此特定命令才有效。 -d参数表示将定位唯一连接的设备。但是您可以使用其他参数:

  • -e will target the only running emulator
  • -e将定位唯一正在运行的模拟器
  • -s will target a device with a specific serial number.
  • -s 将以具有特定序列号的设备为目标。

#5


27  

Using Android Studio 3.0 or later version it is possible to pull database (also shared preference, cache directory and others) if application runs in debug mode on non-rooted device.

如果应用程序在非root设备上以调试模式运行,则可以使用Android Studio 3.0或更高版本来提取数据库(也可以是共享首选项,缓存目录等)。

To pull database using android studio follow these steps.

要使用android studio拉数据库,请按照以下步骤操作。

  1. Click View > Tool Windows > Device File Explorer.
  2. 单击视图>工具窗口>设备文件资源管理器
  3. Expand /data/data/[package-name] nodes.
  4. 展开/ data / data / [package-name]节点。

Steps followed in Android Studio 3.0

#6


5  

For Ubuntu (not only?):

对于Ubuntu(不仅仅是?):

see Sergeis Answer but instead of openssl use zlib-flate:

请参阅Sergeis Answer但不使用openssl使用zlib-flate:

cat appbackup.ab | (dd bs=24 count=0 skip=1; cat) | zlib-flate -uncompress > appbackup.tar

cat appbackup.ab | (dd bs = 24 count = 0 skip = 1; cat)| zlib-flate -uncompress> appbackup.tar

Otherwise openssl will probably throw:

否则openssl可能会抛出:

openssl:Error: 'zlib' is an invalid command.

openssl:错误:'zlib'是一个无效的命令。

because openssl is not compiled with zlib support in Ubuntu

因为在Ubuntu中没有使用zlib支持编译openssl

#7


5  

 adb shell "run-as [package.name] chmod -R 777 /data/data/[package.name]/databases" 
 adb shell "mkdir -p /sdcard/tempDB" 
 adb shell "cp -r /data/data/[package.name]/databases/ /sdcard/tempDB/." 
 adb pull sdcard/tempDB/ . 
 adb shell "rm -r /sdcard/tempDB/*"

#8


1  

Since, nothing really work for me. I create a little windows BATCH script based on other answers combined together. Hope it help somebody. Simply usage: backupDatabase [TargetDirectory]. It use Sergei's backup method and Android Backup Extractor.

从那以后,没有什么对我有用。我根据其他答案组合在一起创建一个小的Windows BATCH脚本。希望它对某人有所帮助。简单用法:backupDatabase [TargetDirectory]。它使用Sergei的备份方法和Android Backup Extractor。

@echo off

if [%1]==[] goto usage
if [%2]==[] goto usage
if NOT [%4]==[] goto usage

@echo Processing: preparations
set PACKAGE=%1
set APPLICATION_NAME=%2
set TARGET_DIR=%cd%
IF NOT "%~3"=="" set TARGET_DIR=%3

set PATH_ADB="c:\Program Files (x86)\Android\android-studio\sdk\platform-tools"
set PATH_ABE="c:\Programs\android-backup-extractor-20140630-bin"
set PATH_7Z="c:\Program Files\7-Zip"

@echo Processing: backup
%PATH_ADB%\adb.exe backup -f %TARGET_DIR%\%APPLICATION_NAME%\%APPLICATION_NAME%.ab -noapk %PACKAGE%

@echo Processing: unpack
java -jar %PATH_ABE%\abe.jar unpack %TARGET_DIR%\%APPLICATION_NAME%\%APPLICATION_NAME%.ab %TARGET_DIR%\%APPLICATION_NAME%\%APPLICATION_NAME%.ab.tar

@echo Processing: extract
cd %TARGET_DIR%\%APPLICATION_NAME%
%PATH_7Z%\7z.exe e %APPLICATION_NAME%.ab.tar "apps\%PACKAGE%\db\%APPLICATION_NAME%"

@echo Processing: cleaning
del %APPLICATION_NAME%.ab
del %APPLICATION_NAME%.ab.tar
goto :eof

:usage
@echo.Pull out SQLite database file from your android device.
@echo.Needs: - connected device
@echo.       - device enable backup.
@echo.       - application enable backup
@echo.       - application in debug mode
@echo.       - installed Android Backup Extractor 
@echo.       - installed command line TAR extractor (7z, ...)
@echo.Does NOT need: root device
@echo.
@echo.Uses: - ADB backup (set PATH_ADB)
@echo.      - Android Backup Extractor (http://sourceforge.net/projects/adbextractor/) (set PATH_ABE)
@echo.      - Extract TAR container, uses 7z (set PATH_7Z)
@echo.
@echo.Usage: backupDatabase ^ ^ [TargetDirectory]
@echo.Example: backupDatabase com.foo.example ExampleApp 
@echo Example: backupDatabase com.foo.example ExampleApp workspace\AndroidProjects\Example
exit /B 1

#9


1  

you can easily extract the sqlite file from your device(root no necessary)

您可以轻松地从您的设备中提取sqlite文件(root无需)

  1. Go to SDK Folder
  2. 转到SDK文件夹
  3. cd platform-tools
  4. cd平台工具
  5. start adb

    开始adb

    cd /sdk/platform-tools ./adb shell

    Then type in the following command in terminal

    cd / sdk / platform-tools ./adb shell然后在终端输入以下命令

    ./adb -d shell "run-as com.your_packagename cat /data/data/com.your_packagename/databases/jokhanaNepal > /sdcard/jokhana.sqlite"

    For eg

    ./adb -d shell“run-as com.your_packagename cat /data/data/com.your_packagename/databases/jokhanaNepal> /sdcard/jokhana.sqlite”For eg eg

    ./adb -d shell "run-as com.yuvii.app cat /data/data/com.yuvii.app/databases/jokhanaNepal > /sdcard/jokhana.sqlite"

    ./adb -d shell“run-as com.yuvii.app cat /data/data/com.yuvii.app/databases/jokhanaNepal> /sdcard/jokhana.sqlite”

#11


1  

On Mac (NO root required)

在Mac上(无需root)

1. Go to platform-tools folder.
2) Run following command in terminal.

./adb -d shell "run-as your.package.name cat databases/database.sqlite" > database.sqlite

It will copy the sqlite file in platform-tools folder.

它将复制platform-tools文件夹中的sqlite文件。

#12


0  

 > is it possible to pull in any way a database of an Android device without having to root it? 

yes if your android app creates a file copy of the database that is accessable by everyone.

是的,如果您的Android应用程序创建了每个人都可以访问的数据库的文件副本。

android protects apps private data so it is not visible/accessable by other apps. a database is private data. your app can of course read the database-file so it can do a file-copy to some public visible file.

android保护应用程序私有数据,因此其他应用程序不可见/可访问。数据库是私有数据。您的应用程序当然可以读取数据库文件,以便它可以对某些公共可见文件进行文件复制。

#13


0  

On a rooted device you can:

在root设备上,您可以:

// check that db is there
>adb shell
# ls /data/data/app.package.name/databases
db_name.sqlite // a custom named db
# exit
// pull it
>adb pull /data/app.package.name/databases/db_name.sqlite

#14


0  

Based on the answer given by Lam Vinh, here is a simple batch file that works for me on my 1st gen Nexus 7. It prompts the user to enter the package name and then the database name (without the .sqlite extension) and puts it in c:\temp. This assumes you have the Android sdk set in the environment variables.

基于Lam Vinh给出的答案,这是一个简单的批处理文件,在我的第一代Nexus 7上适用于我。它会提示用户输入包名称,然后输入数据库名称(不带.sqlite扩展名)并将其放入在c:\ temp。假设您在环境变量中设置了Android sdk。

@echo off
cd c:\temp\

set /p UserInputPackage= Enter the package name: 
set /p UserInputDB= Enter the database name: 

@echo on
adb shell "run-as %UserInputPackage% chmod 666 /data/data/%UserInputPackage%/databases/%UserInputDB%.sqlite"
adb pull /data/data/%UserInputPackage%/databases/%UserInputDB%.sqlite
@echo off
pause

#15


0  

If you are on Android 4.0 or above, and you are on a mac, then here is a ruby script that will save your app contents to the desktop. I would imagine this would also work in Ubuntu, though I didn't test it.

如果您使用的是Android 4.0或更高版本,并且您使用的是Mac,则此处是一个ruby脚本,可将您的应用内容保存到桌面。我想这也适用于Ubuntu,虽然我没有测试它。

puts "enter your package name"
package_name = gets.chomp
puts "press the 'Back up my data' button on your device"
`adb backup -f ~/Desktop/data.ab -noapk #{package_name}`
puts "press enter once once the 'Backup finished' toast has appeared"
gets.chomp
puts "extracting..."
`dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf -`

to run -> ruby your_ruby_file_name.rb

运行 - > ruby​​ your_ruby_file_name.rb

This script is "happy path" only, so please make sure your device is connected and that adb has been added to your profile.

此脚本仅为“快乐路径”,因此请确保您的设备已连接且该adb已添加到您的个人资料中。

#16


0  

Here is a solution with pictures about how you can access a not rooted 4.2 android phone's file system by ssh from ubuntu 16.04

这是一个解决方案,图片说明如何通过ssh从ubuntu 16.04访问一个没有root的4.2 android手机的文件系统

how to access a not rooted 4.2 android phone's file system by ssh from ubuntu 16.04

如何通过ssh从ubuntu 16.04访问一个没有root的4.2 android手机的文件系统

#17


0  

If you are trying to do it on android 6 request the permission and use the code of the answer of this question

如果您尝试在Android 6上执行此操作请求权限并使用此问题的答案代码

if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { 
    ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, STORAGE_PERMISSION_RC); 
    return; 
} 

Once it is granted

一旦获得批准

@Override 
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    if (requestCode == STORAGE_PERMISSION_RC) {
        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            //permission granted  start reading or writing database
        } else { 
            Toast.makeText(this, "No permission to read external storage.", Toast.LENGTH_SHORT).show();
        } 
    } 
} 

#18


0  

I give the complete solution to "save" and "restore" the app database to/from the internal storage (not to the PC with adb).

我提供了完整的解决方案,将应用程序数据库“保存”和“恢复”到内部存储器(或从内部存储器“恢复”到具有adb的PC)。

I have done two methods one for save and other for restore the database. Use these methods at the end of the onCreate() in MainActivity (one or the other if you want to saver or restore the database).

我已经完成了两个方法,一个用于保存,另一个用于恢复数据库。在MainActivity中的onCreate()末尾使用这些方法(如果要保存或恢复数据库,请使用其中一种方法)。

save database to internal storage:

将数据库保存到内部存储:

void copyDatabase (){
        try {
            final String inFileName = "/data/data//databases/database.db";
            final String outFileName = Environment.getExternalStorageDirectory() + "database_backup.db";
            File dbFile = new File(inFileName);
            FileInputStream fis = new FileInputStream(dbFile);


            Log.d(TAG, "copyDatabase: outFile = " + outFileName);

            // Open the empty db as the output stream
            OutputStream output = new FileOutputStream(outFileName);

            // Transfer bytes from the inputfile to the outputfile
            byte[] buffer = new byte[1024];
            int length;
            while ((length = fis.read(buffer)) > 0) {
                output.write(buffer, 0, length);
            }

            // Close the streams
            output.flush();
            output.close();
            fis.close();
        }catch (Exception e){
            Log.d(TAG, "copyDatabase: backup error");
        }
    }

restore database from internal storage:

从内部存储恢复数据库:

void restoreDatabase (){
        try {
            final String inFileName = Environment.getExternalStorageDirectory() + "database_backup.db";
            final String outFileName = "/data/data//databases/database.db";
            File dbFile = new File(inFileName);
            FileInputStream fis = new FileInputStream(dbFile);

            Log.d(TAG, "copyDatabase: outFile = " + outFileName);

            // Open the empty db as the output stream
            OutputStream output = new FileOutputStream(outFileName);

            // Transfer bytes from the inputfile to the outputfile
            byte[] buffer = new byte[1024];
            int length;
            while ((length = fis.read(buffer)) > 0) {
                output.write(buffer, 0, length);
            }

            // Close the streams
            output.flush();
            output.close();
            fis.close();
        }catch (Exception e){
            Log.d(TAG, "copyDatabase: backup error");
        }
    }

#19


0  

It is always better if things are automated.That's why I wrote simple python script for copying db file from device using ADB. It saves a lot of development time if you're doing it frequently.

事情是自动化的总是更好。这就是为什么我编写简单的python脚本来使用ADB从设备复制db文件。如果你经常这样做,它可以节省大量的开发时间。

Works only with debuggable apps if device is Not rooted.

如果设备未植根,则仅适用于可调试应用程序。

Here is link to the gist.

这是与要点的链接。

Run it as : python copyandroiddbfile.py

运行方式为:python copyandroiddbfile.py

import sys
import subprocess
import re

#/
# Created by @nieldeokar on 25/05/2018.
#/

# 1. Python script which will copy database file of debuggable apps from the android device to your computer using ADB.
# 2. This script ask for PackageName and DatabaseName at runtime.
# 3. You can make it static by passing -d at as command line argument while running script and setting defaults in following way.
# 4. Edit script and change the values of varialbe packageName and dbName to debuggable app package name and database name then
# run script as : python Copydbfileandroid.py -d 

useDefaults = False


def checkIfPackageInstalled(strSelectedDevice) :

    packageName = 'com.nileshdeokar.healthapp.debug'
    dbName = 'healthapp.db'


    if not useDefaults : 
        print('Please enter package name : ')
        packageName = raw_input()

    packageString = 'package:'+packageName

    try:
        adbCheckIfPackageInstalledOutput = subprocess.check_output('adb -s ' + strSelectedDevice + ' shell pm list packages | grep -x '+ packageString, shell=True)
    except subprocess.CalledProcessError as e:
                print "Package not found"
                return


    if packageString.strip() == adbCheckIfPackageInstalledOutput.strip() : 
        if not useDefaults : 
            print('Please enter db name : ')
            dbName = raw_input()

        adbCopyDbString = 'adb -s '+strSelectedDevice + ' -d shell \"run-as '+packageName+' cat /data/data/'+packageName+'/databases/'+ dbName +'\" > '+dbName

        try:
            copyDbOp = subprocess.check_output(adbCopyDbString,shell=True)
        except subprocess.CalledProcessError as e:
                return

        if "is not debuggable" in copyDbOp :
            print packageString + 'is nto debuggable'

        if copyDbOp.strip() == "":
            print 'Successfully copied '+dbName + ' in current directory'

    else :
        print 'Package is not installed on the device'



defaultString = "-d"
if len(sys.argv[1:]) > 0 and sys.argv[1] == defaultString :
        useDefaults = True

listDevicesOutput = subprocess.check_output("adb devices", shell=True)
listDevicesOutput = listDevicesOutput.replace("List of devices attached"," ").replace("\n","").replace("\t","").replace("\n\n","")

numberofDevices = len(re.findall(r'device+', listDevicesOutput))

cOnnectedDevicesArray= listDevicesOutput.split("device")   
del connectedDevicesArray[-1] 


strSelectedDevice = ''
if(numberofDevices > 1) :
    print('Please select the device : \n'),

    for idx, device in enumerate(connectedDevicesArray):
        print idx+1,device

    selectedDevice = raw_input()

    if selectedDevice.isdigit() :
        intSelected = int(selectedDevice)
        if 1 <= intSelected <= len(connectedDevicesArray) :
            print 'Selected device is : ',connectedDevicesArray[intSelected-1]
            checkIfPackageInstalled(connectedDevicesArray[intSelected-1])
        else :
            print 'Please select in range'
    else : 
        print 'Not valid input'

elif numberofDevices == 1 :
    checkIfPackageInstalled(connectedDevicesArray[0])
elif numberofDevices == 0 :
    print("No device is attached")

#20


-1  

If you want your database file

如果您需要数据库文件

See the DDMS > File explore

请参阅DDMS>文件浏览

find your db file from your package name

从包名中找到您的db文件

then Click on pull a file from device (Rooted device only)

然后单击从设备中提取文件(仅限Root设备)


推荐阅读
  • 本文介绍了设计师伊振华受邀参与沈阳市智慧城市运行管理中心项目的整体设计,并以数字赋能和创新驱动高质量发展的理念,建设了集成、智慧、高效的一体化城市综合管理平台,促进了城市的数字化转型。该中心被称为当代城市的智能心脏,为沈阳市的智慧城市建设做出了重要贡献。 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • 使用Ubuntu中的Python获取浏览器历史记录原文: ... [详细]
  • 关于我们EMQ是一家全球领先的开源物联网基础设施软件供应商,服务新产业周期的IoT&5G、边缘计算与云计算市场,交付全球领先的开源物联网消息服务器和流处理数据 ... [详细]
  • 本文介绍了一个在线急等问题解决方法,即如何统计数据库中某个字段下的所有数据,并将结果显示在文本框里。作者提到了自己是一个菜鸟,希望能够得到帮助。作者使用的是ACCESS数据库,并且给出了一个例子,希望得到的结果是560。作者还提到自己已经尝试了使用"select sum(字段2) from 表名"的语句,得到的结果是650,但不知道如何得到560。希望能够得到解决方案。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • 本文详细介绍了如何使用MySQL来显示SQL语句的执行时间,并通过MySQL Query Profiler获取CPU和内存使用量以及系统锁和表锁的时间。同时介绍了效能分析的三种方法:瓶颈分析、工作负载分析和基于比率的分析。 ... [详细]
  • 本文介绍了Swing组件的用法,重点讲解了图标接口的定义和创建方法。图标接口用来将图标与各种组件相关联,可以是简单的绘画或使用磁盘上的GIF格式图像。文章详细介绍了图标接口的属性和绘制方法,并给出了一个菱形图标的实现示例。该示例可以配置图标的尺寸、颜色和填充状态。 ... [详细]
  • 本文介绍了绕过WAF的XSS检测机制的方法,包括确定payload结构、测试和混淆。同时提出了一种构建XSS payload的方法,该payload与安全机制使用的正则表达式不匹配。通过清理用户输入、转义输出、使用文档对象模型(DOM)接收器和源、实施适当的跨域资源共享(CORS)策略和其他安全策略,可以有效阻止XSS漏洞。但是,WAF或自定义过滤器仍然被广泛使用来增加安全性。本文的方法可以绕过这种安全机制,构建与正则表达式不匹配的XSS payload。 ... [详细]
  • 纠正网上的错误:自定义一个类叫java.lang.System/String的方法
    本文纠正了网上关于自定义一个类叫java.lang.System/String的错误答案,并详细解释了为什么这种方法是错误的。作者指出,虽然双亲委托机制确实可以阻止自定义的System类被加载,但通过自定义一个特殊的类加载器,可以绕过双亲委托机制,达到自定义System类的目的。作者呼吁读者对网上的内容持怀疑态度,并带着问题来阅读文章。 ... [详细]
  • 基于Socket的多个客户端之间的聊天功能实现方法
    本文介绍了基于Socket的多个客户端之间实现聊天功能的方法,包括服务器端的实现和客户端的实现。服务器端通过每个用户的输出流向特定用户发送消息,而客户端通过输入流接收消息。同时,还介绍了相关的实体类和Socket的基本概念。 ... [详细]
  • 本文介绍了Android中的assets目录和raw目录的共同点和区别,包括获取资源的方法、目录结构的限制以及列出资源的能力。同时,还解释了raw目录中资源文件生成的ID,并说明了这些目录的使用方法。 ... [详细]
  • ***byte(字节)根据长度转成kb(千字节)和mb(兆字节)**parambytes*return*publicstaticStringbytes2kb(longbytes){ ... [详细]
  • Postgresql备份和恢复的方法及命令行操作步骤
    本文介绍了使用Postgresql进行备份和恢复的方法及命令行操作步骤。通过使用pg_dump命令进行备份,pg_restore命令进行恢复,并设置-h localhost选项,可以完成数据的备份和恢复操作。此外,本文还提供了参考链接以获取更多详细信息。 ... [详细]
author-avatar
惠玲琦扬2
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有