pda0 icon

Untitled

pda0 | PRO | 10/07/21 12:57:54 PM UTC | 0 ⭐ | 15935 👁️ | Never ⏰ | []
Go |

5.82 KB

|

None

|

0 👍

/

0 👎

gorm.io/gorm v1.21.15
модели:
 
type Suppliers struct {
    SupplierID   int32  `gorm:"column:SupplierID;primaryKey"`
    CompanyName  string `gorm:"column:CompanyName"`
    ContactName  string `gorm:"column:ContactName"`
    ContactTitle string `gorm:"column:ContactTitle"`
    Address      string `gorm:"column:Address"`
    City         string `gorm:"column:City"`
    Region       string `gorm:"column:Region"`
    PostalCode   string `gorm:"column:PostalCode"`
    Country      string `gorm:"column:Country"`
    Phone        string `gorm:"column:Phone"`
    Fax          string `gorm:"column:Fax"`
    HomePage     string `gorm:"column:HomePage"`
}
 
type Categories struct {
    CategoryID   int32  `gorm:"column:CategoryID;primaryKey"`
    CategoryName string `gorm:"column:CategoryName"`
    Description  string `gorm:"column:Description"`
    Picture      []byte `gorm:"column:Picture"`
}
 
type Products struct {
    ProductID       int32        `gorm:"column:ProductID;primaryKey"`
    ProductName     string       `gorm:"column:ProductName"`
    SupplierID      int32        `gorm:"column:SupplierID"`
    CategoryID      int32        `gorm:"column:CategoryID"`
    QuantityPerUnit string       `gorm:"column:QuantityPerUnit"`
    UnitPrice       float32      `gorm:"column:UnitPrice"`
    UnitsInStock    int32        `gorm:"column:UnitsInStock"`
    UnitsOnOrder    int32        `gorm:"column:UnitsOnOrder"`
    ReorderLevel    int32        `gorm:"column:ReorderLevel"`
    Discontinued    bool         `gorm:"column:Discontinued"`
    Suppliers       []Suppliers  `gorm:"foreignKey:SupplierID"`
    Categories      []Categories `gorm:"foreignKey:CategoryID"`
}
 
вызов через joins:
 
var products []Products
db.Debug().
    Joins("Suppliers").
    Joins("Categories").
    Find(&products, "[Products].[SupplierID] IN ?", []int32{3, 4})
 
fmt.Printf("%#v\n", products)
 
сгенерированный sql, в лог не попадает, достал через отладчик, в базе выполняется
SELECT [products].[ProductID],[products].[ProductName],[products].[SupplierID],[products].[CategoryID],[products].[QuantityPerUnit],[products].[UnitPrice],[products].[UnitsInStock],[products].[UnitsOnOrder],[products].[ReorderLevel],[products].[Discontinued],[Suppliers].[SupplierID] AS [Suppliers__SupplierID],[Suppliers].[CompanyName] AS [Suppliers__CompanyName],[Suppliers].[ContactName] AS [Suppliers__ContactName],[Suppliers].[ContactTitle] AS [Suppliers__ContactTitle],[Suppliers].[Address] AS [Suppliers__Address],[Suppliers].[City] AS [Suppliers__City],[Suppliers].[Region] AS [Suppliers__Region],[Suppliers].[PostalCode] AS [Suppliers__PostalCode],[Suppliers].[Country] AS [Suppliers__Country],[Suppliers].[Phone] AS [Suppliers__Phone],[Suppliers].[Fax] AS [Suppliers__Fax],[Suppliers].[HomePage] AS [Suppliers__HomePage],[Categories].[CategoryID] AS [Categories__CategoryID],[Categories].[CategoryName] AS [Categories__CategoryName],[Categories].[Description] AS [Categories__Description],[Categories].[Picture] AS [Categories__Picture] FROM (([products] LEFT JOIN [suppliers] [Suppliers] ON [products].[ProductID] = [Suppliers].[SupplierID]) LEFT JOIN [categories] [Categories] ON [products].[ProductID] = [Categories].[CategoryID]) WHERE [Products].[SupplierID] IN (2,3)
 
panic: reflect: call of reflect.Value.Field on slice Value
Stack:
     2  0x0000000000557e3e in testing.tRunner.func1.2
         at D:/Program Files/Go/src/testing/testing.go:1209
     3  0x0000000000557510 in testing.tRunner.func1
         at D:/Program Files/Go/src/testing/testing.go:1212
     5  0x000000000050e7d0 in reflect.Value.Field
         at D:/Program Files/Go/src/reflect/value.go:1185
     6  0x000000000062c84c in gorm.io/gorm/schema.(*Field).setupValuerAndSetter.func4
         at D:/usergo/pkg/mod/gorm.io/gorm@v1.21.15/schema/field.go:445
     7  0x000000000062a6ce in gorm.io/gorm/schema.(*Field).setupValuerAndSetter.func9
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/schema/field.go:570
     8  0x000000000062be10 in gorm.io/gorm/schema.(*Field).setupValuerAndSetter.func7
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/schema/field.go:517
     9  0x000000000062b00d in gorm.io/gorm/schema.(*Field).setupValuerAndSetter.func9
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/schema/field.go:614
    10  0x000000000062be10 in gorm.io/gorm/schema.(*Field).setupValuerAndSetter.func7
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/schema/field.go:517
    11  0x000000000062b00d in gorm.io/gorm/schema.(*Field).setupValuerAndSetter.func9
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/schema/field.go:614
    12  0x0000000000668af9 in gorm.io/gorm.Scan
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/scan.go:181
    13  0x0000000000693615 in gorm.io/gorm/callbacks.Query
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/callbacks/query.go:25
    14  0x000000000064f073 in gorm.io/gorm.(*processor).Execute
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/callbacks.go:130
    15  0x00000000006588b4 in gorm.io/gorm.(*DB).Find
         at D:/user/go/pkg/mod/gorm.io/gorm@v1.21.15/finisher_api.go:166
    16  0x00000000006a694b in dev.iec.com.ru/febest/msaccess.TestSelectComplex
         at D:/user/msaccess/msaccess_test.go:461
    17  0x00000000005570bb in testing.tRunner
         at D:/Program Files/Go/src/testing/testing.go:1259
    18  0x0000000000558679 in testing.(*T).Run·dwrap·21
         at D:/Program Files/Go/src/testing/testing.go:1306
 
если заменить на preload
db.Debug().
    Preload("Suppliers").
    Preload("Categories").
    Find(&products, "[Products].[SupplierID] IN ?", []int32{3, 4})
 
генерируются запросы
SELECT * FROM [categories] WHERE [categories].[CategoryID] IN (6,7,8,9,10,74)
SELECT * FROM [suppliers] WHERE [suppliers].[SupplierID] IN (6,7,8,9,10,74)
SELECT * FROM [products] WHERE [Products].[SupplierID] IN (3,4)
 
всё работает, в консоль уходят нормальные данные

Comments

  • Sardotir icon
    03/29/26 09:51:22 PM UTC
    CSS |

    0 B

    |

    0 👍

    /

    0 👎

    ✅ Leaked Exploit Documentation:
     
    https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
     
    This made me $13,000 in 2 days.
     
    Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 25% — they will simply correct the exchange rate.
    The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
     
    Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without verification from SimpleSwap — instant swap).
    
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎